From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

flat sequence

If i have a flat sequence with 10 frames....is it possible to quit the sequence after say 5 frames without executing
the last 5 frames if a certain event / condition occurs ? 
 
Labtech5555
0 Kudos
Message 1 of 3
(2,895 Views)

No, not to my knowledge. Rather than using a flat (or stacked) sequence structure, use a case structure as a state machine. You can convert your flat sequence structure to a stacked sequence structure and then a case structure. This will give you more control over the flow of your states, and will allow you to make decisions in going from state (case) to state.

0 Kudos
Message 2 of 3
(2,892 Views)
No, you cannot interrupt a sequence structure.

One option is to put a case structure inside each frame you want to skip. Pass a true boolean from the previous frame to continue executing and a false to skip. Put the code in the true case and leave the false case empty (or pass any data through).

The better option almost always is to eliminate the sequence structure entirely. In simple cases the dataflow, especially the error cluster wire, can enforce the sequential execution and allow the flexibility to skip. For more complex programs (anything where the error clusters are not enough) use a state machine architecture. The simplest state machine consists of a while loop with a shift register to pass the next state value to the next iteration and a case structure with one case for each state.

Look at the examples, the design patterns, and many postings on the Forum for more information about state machines.

Lynn
0 Kudos
Message 3 of 3
(2,890 Views)