LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get number of iterations of case structure

I have a case structure running in a while loop and I need to get the number of times the case runs true. Ideally, I would like this count to reset when the case changes to false. A point in the right direction would be greatly appreciated. I thought about using local variables but that would slow down the loop.

Thanks!
Tim
0 Kudos
Message 1 of 5
(3,829 Views)
Use a shift register. Check the LabVIEW Help and tutorial on how to use shift registers.

Why do you think that a local variable would slow down the loop?

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
0 Kudos
Message 2 of 5
(3,826 Views)
Use an integer shift register on the while loop, initialise it to zero, then increment it in the true case. Set it to zero again in the false case
_____________________________
- Cheers, Ed
Message 3 of 5
(3,824 Views)
Ok wow, I don't know how I missed that...much easier than the convoluted solution I had in mind. I feel quite dumb but problem solved.
Thanks for the help!
Must get more sleep 🙂
0 Kudos
Message 4 of 5
(3,810 Views)

I thought about using local variables but that would slow down the loop.

And Why do you think so?
0 Kudos
Message 5 of 5
(3,775 Views)