LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do case statement based on array of 3 or more values?

Solved!
Go to solution

I'm trying to figure how to do a comparison  or case structure...based on the setting of an array of 3 (or possibly more) boolean.

 

Say I have an array (this is coming in from a serial connection, and I'm coverting it back to array to work with) of [T,F,F]  in this case I'd like to display on a status indicator "STBY"

If the array is set to [F,T,F] I'd like to display in that indicator "ON"

If the array is set to [F,F,T] I'd like to display in that indicator "EMPTY"

 

I can't figure out how to compare combinations of things....I"m reading in a byte array, and the first 3 bits in this example, determin what I need to display as status...I can't figure how to do with with a case structure.....or without doing some nasty looking and/or comparison chains...

 

Any suggestions?

 

Thanks in advance,

 

cayenne

0 Kudos
Message 1 of 2
(2,226 Views)
Solution
Accepted by cayenne

You could use Search 1D array and find the first True.

 

Or you could convert the Boolean Array to a U8 integer, and use resulting integer to determine which case to run.  (4, vs, 2, vs 1)

Message 2 of 2
(2,225 Views)