LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how for loop terminates when auto indexed array is connected for loop index=0

Solved!
Go to solution

I have connected an array of 5 elements to an FOR loop with auto indexed enabled  (FOR loop index is not connected ) ,after 5 iteration ie 0-4 loop terminates automatically ..............HOW it gets terminated itself?

 I have attached the image for refrence

 

 

0 Kudos
Message 1 of 7
(3,032 Views)
Hi,

Read the labview help to know more about auto index to an for loop

 

Enabling Auto-Indexing for Loops

If you wire an array to a For Loop or While Loop, you can read and process every element in that array by enabling auto-indexing. When you wire an array from an external node to an input tunnel on the loop border and enable auto-indexing on the input tunnel, elements of that array enter the loop one at a time, starting with the first element (if you are not wired your N terminal then your loop runs no of times of your array size thats what your lopp running for five times).

Complete the following steps to enable or disable auto-indexing for a tunnel on a loop.

  1. Right-click the tunnel at the loop border.
  2. Select Enable Indexing or Disable Indexing from the shortcut menu to enable or disable auto-indexing.
Message Edited by Baji on 03-24-2009 12:19 PM
Message Edited by Baji on 03-24-2009 12:23 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 2 of 7
(3,029 Views)
How many times do you want it to run?  (How would the For Loop know?)  If you want it to run indefinitely you should use a While Loop and index the array manually.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 7
(3,006 Views)

what ever you said is true even i have checked that but in help file it doesn't say any thing about such (if you are not wired your N terminal then your loop runs no of times of your array size ). How to support it with out any refrence

 

0 Kudos
Message 4 of 7
(2,971 Views)
that's what my question is without connecting anything to "N" terminal of FOR loop it stops iterating moment the last element of array is encountered
0 Kudos
Message 5 of 7
(2,970 Views)
Solution
Accepted by prashgn

http://digital.ni.com/public.nsf/allkb/76895DA6D9BFE6B586256F7000745561

http://cnx.org/content/m12221/latest/

 

find the tutorial for How Does a For Loop Decide the Iteration Count When Multiple Auto-Indexed Input Arrays are Present?

Message Edited by Baji on 03-25-2009 02:11 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 6 of 7
(2,962 Views)

Hi,

 

Is your problem solved? If so please mark the post (Whichever you think is the best solution for your query). This will help others facing same problem and looking for a solution.

 

Thanks,

 

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 7 of 7
(2,896 Views)