02-22-2019 07:56 AM - edited 02-22-2019 07:58 AM
The for loop thats on the outside only executes once and not N
02-22-2019 08:09 AM - edited 02-22-2019 08:10 AM
For loops are controlled by the value of N and the sizes of the all the arrays at the auto-indexing input tunnels. The smallest value controls the number of iterations. Your N is 10. But your array is a 1x X size array. 1 is smaller than 10 so the loop iterates 1 time.
I know it is one because you have a X sized 1-D array, so X columns. Then you use Build Array to turn that into a 2-D array. Now is has 1 row by X columns. The loop auto-indexes on the rows, so it only executes once.
Run your VI with highlight execution turned on and watch the data flow on the block diagram.
02-22-2019 08:11 AM
That's because you told it to run exactly once! Do you know how a For Loop works with one or more Indexing Inputs? It runs until the first of those present finishes. In particular, if you bring anything into a For Loop preceding it with a simple "Build Array" (that makes, say, a 1D array into a 2D array with one element), the For Loop will run once, say "OK, I'm done, I've processed the entire Indexed Input", and exit.
Bob Schor
02-22-2019 08:13 AM
ok thanks that makes sense, is there a way to make it controlled by N and not the array size?
02-22-2019 08:21 AM