This can be done by adding a case structure within the while loop as follows, or by dragging the VI snippet to your block diagram if you are running LabVIEW 2013 or later:
In order to select a while loop right click on the block diagram then navigate to Programming>>Structures>>While Loop and drag it onto the diagram.
In order to select a case structure right click on the block diagram then navigate to Programming>>Structures>>Case Structure and drag a case structure into the while loop.
Create a numeric constant outside of the while loop and wire it to the border of the loop.
Right click on this tunnel and select Replace with Shift Register.
Place a boolean control on the Front Panel. This is our reset button that will reset the shift register in the while loop. (The boolean can also be an indicator that shows if a case is true or false in your code).
Wire the boolean control (or indicator) to the Case Selector of the case structure.
In the True case, place a numeric constant of zero and wire to an output tunnel on the Case Structure.
In the False case, wire the data through to the output terminal.
Wire the output terminal of the case structure to the shift register on the right side of the while loop.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.