ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a case structure execute multiple cases?

Solved!
Go to solution

So I have a VI set up with a mutiple option case structure to select which input a voltage is read from (there are 32 options). Now that I have it made, I realize that sometimes I may want to read from multiple inputs at once.. Is there an easy way to change my setup so that it executes multiple cases at a time? Right now my control is a slider to choose the case. What would be a good front panel control choice to be able to select multiple options? Thanks

0 Kudos
Message 1 of 5
(6,505 Views)

There is no way to execute two cases at the same time.  What you could do is combine the code from two cases into one.

- tbob

Inventor of the WORM Global
Message 2 of 5
(6,497 Views)

No the case structure will only run a single case each time through the case structure.

 

You need to put the case structure inside a while loop to execute it more than once.

 

You need a STATE MACHINE

 

If the options are simple you could use a For loop and load an array with the cases you want to run.

Omar
Message 3 of 5
(6,495 Views)
Solution
Accepted by topic author ENGRLAB

You can build an array of your options and loop through the required cases. As mentioned, a case can only perform 1 case per loop.

 

A good front panel control would be a cluster or an array of booleans (e.g. a tick box per option), easy to loop through. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 5
(6,481 Views)

I'll give it a shot. Thanks for the suggestions!

0 Kudos
Message 5 of 5
(6,464 Views)