LabVIEW Basics - 11 | Passing Data Into and Out of Loops
Data can be passed into and out of both for loops and while loops. There are several options for controlling how a loop handles data.
- Passing a data wire into or out of a loop creates a tunnel.
- Each loop iteration the same value is provided at an input tunnel.
- A loop must execute to completion before passing any data out through a tunnel.
- Upon completion the last value at the output tunnel is passed out.
- Shift Registers can be used to pass data from one loop iteration to the next.
- To create a shift register right click the edge of the loop and choose Add Shift Register
- To change a tunnel to a shift register right click the tunnel and choose Replace with shift register.
- When passing Arrays into a loop Auto Indexing can be used to iterate over the array.
- To auto index an array right click on the tunnel and choose Enable Indexing.
- Each loop iteration the next value in the array is passed into the loop.
- Auto Indexing can also be used on loop outputs to automatically create arrays of data.