LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to skip a for loop iteration containing multiple event structures and while loops?

I am currently trying to set up my VI so that I can end the current iteration of a For loop if i choose to. My VI contains 2 event structures and several While loops. Right now I have an event in both event structures to stop them when a button is pressed. This works if I have not ended one or both of the event loops already but if I've already ended one of the event structures, it queues the stop event and executes it on the next iteration of the For loop. How do I prevent this from happening? If that is not possible, what is another way to program what I want to accomplish? Thank you!

0 Kudos
Message 1 of 3
(2,829 Views)

Hi Levitan,

 

general rule: don't use more than one event structure per VI.

general rule: don't use the same event in several event structures.

(Unless you REALLY know what you are doing!)

 

Convert your VI into a real state machine - it will make your life (a lot) easier!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,808 Views)

OMG! Rube Goldberg much?

 

 

 

@GerdW wrote:

Hi Levitan,

 

general rule: don't use more than one event structure per VI.

general rule: don't use the same event in several event structures.

(Unless you REALLY know what you are doing!)

 

Convert your VI into a real state machine - it will make your life (a lot) easier!

 

Listen to GerdW and most importantly Convert your VI into a real state machine!

 

Each "frame" of your flat sequence should be state in a state machine, except for your second frame (the one with three loops) that should be three or four separate states. Use shift registers to pass values from one state to the next, not a bunch of local variables..

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 3
(2,797 Views)