Set the number of iterations to 10, by using a constant.Place a for loop in it from function palette>structures>for loop as shown below.For this purpose create a blank VI and save it as done in previous tutorials. As an example, consider a ‘for’ loop that generate random numbers in the output.The output array receives a new element from every iterations when you auto-index an array output tunnel. While loop iterates until a specific condition is satisfied, therefore, the number of iterations a While Loop executes is not limited by the size of the array. The while loop indexes of the array work in the same manner as that of for loop when you enable auto-indexing for an array entering a While Loop. When working with while loop auto-Indexing is disabled by default, so the wiring tunnel will be solid. You can also change this setting by clicking right on the tunnel and select Disable Indexing or Enable Indexing. Last iteration data will be received if you disable auto-indexing in the output tunnel and not the elements individually. Hence the size and number of iterations of the auto-indexed output array are always equal. The output array receives a new element from every iteration of the loop, when you auto-index an array output tunnel. ‘For’ loop handles all the elements in the array at once if you disable auto-indexing input instead of handling an element per iteration. If processing array elements in array individually is not required you can also disable auto-indexing. Therefore, auto-indexing is enabled by default for every array you wire to a For Loop. LabView also sets the count terminal to the array if you enable auto-indexing on an array wired to a For Loop input terminal, so you do not need to wire the count terminal.Ĭommon application of a ‘For’ loop is basically is to process the individual elements of array.
This setting is unique in all versions of LabView using either for loop or while loop. What do these differences in the tunnels represent?When you have small brackets inside the tunnels, auto-indexing is enabled. Using loops in LabView you may have noticed and whenever you place an outgoing wire through a loop, the tunnel is either solid or have square brackets on them. Disabling auto-indexing in labview Introduction to auto indexing in Labview.Introduction to auto indexing in Labview.