LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple cases in a single case frame

Solved!
Go to solution

Hi,

 

I want to realize such a function as following in LabVIEW

 

if(1<a<4&&11.8<b<12.5)

I=I++;

else if(9<a<12.5&&0.9<b<1.3)

I=I--;

else

I=I;

 

I tried to combine several boolean together, but it turned out to be a huge "building", so please somebody here help me out, thanks!

0 Kudos
Message 1 of 3
(3,824 Views)
Solution
Accepted by topic author thitchen

You can have a case structure inside a case structure.  So the case structure that is inside the False case of the outermost case structure would be equivalent to the ElseIf portion of the code.  That isn't that complicated to setup.  In your case, since the code inside each case is a simple calculation just passing on data or modifying it, a couple select statements would work as well.

 

Where things are a little more complicated is the evaluation of your boolean expressions since they consist of multiple comparisons ANDed to together.  But it isn't that bad, as you just as to build the boolean logic using the primitives LabVIEW provides.  And since you have 4 conditions that all must be true for either of the boolean expressions to be true, you can use the compound arithmetic node (available on the numeric and boolean palettes) set for the AND mode to combine the multiple conditions.

 

Give it a try, then if you get stuck, post your VI and we can help you improve it.

Message 2 of 3
(3,822 Views)

thank you

0 Kudos
Message 3 of 3
(3,764 Views)