Search code examples
labview

How do I manually increment/decrement index in a Labview for/while loop


Here is my basic use case:

After Labview receives a trigger from external hardware start collecting analog data. It monitors this data and triggers another piece of hardware if the analog data reaches a threshold. This threshold can have different values for each trial. However, the operator might want to be able to redo a trial (if the trigger is sent to early because of noise or the threshold isn't reached as expected).

Is it possible to increment/decrement the index or do I need to use a shift register that I can either increment/decrement as needed (ie decrement it if the redo button is pressed)?

Thanks

Azim


Solution

  • Without getting into the nitty-gritty of your application and to answer your actual question, no, you can not affect the value that comes out of the index node in a for or while loop. It autoincrements by one for every loop iteration.

    Application-wise, you may want to look into a State Machine. It sounds like you might be able to use that for what you're trying to do.