06-04-2014 09:23 AM - edited 06-04-2014 09:30 AM
In what cases will a for loop run with no N value wired to the loop? I've seen a couple of examples of the for loop running without a number of times set to be ran wired to it or for example an array size or something like that.
Solved! Go to Solution.
06-04-2014 09:28 AM
Auto-indexing input tunnel.
Please refer to the LabVIEW help for detailed information on this.
Norbert
06-04-2014 09:28 AM
06-04-2014 09:34 AM
The number of times a FOR loop runs is the minimum of what is wired to the N terminal and the size of the smallest array that is autoindexing into it.
So if you have two arrays autoindexing into a FOR loop, one having 3 elements and the other having 5, the loop will iterate 3 times. If you wire a 10 to N, it will still only iterate 3 times. If you wire a 2 to the N, then it will only run twice. Clear as mud?
06-04-2014 09:42 AM
Below is a program I am working on and as you can see by the image that the program runs without the N loop being wired. The program runs with no issue
06-04-2014 10:17 AM
Why not post an image of the entire for for loop? It seems you are stuck on the N being wired, but as others pointed out the N terminal is not the only control for how many iterations the loop runs. Try posting a complete image if you are looking for help.
06-04-2014 10:28 AM - edited 06-04-2014 10:33 AM
@PauldePaor wrote:
Below is a program I am working on and as you can see by the image that the program runs without the N loop being wired. The program runs with no issue
As everyone else has been saying, you DO NOT have to wire something to N. If you wire an array to the for-loop as an "auto-index" input, the for-loop will automatically run for the size of the smallest array.
Perhaps an example will help:
This loops over the size of my array (in this case, 5 elements long). The symbol on the edge of the for-loop that looks like brackets [ ], indicates that it is auto-indexed. The loop will iterate over each element one at a time (1, then 2, then 3, then 4, then 5).