LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create a three way decision?

I have created multiple decision structures before using an enumerated data type.
 
I am attempting to try something different, though.  I have this decision that involves two boolean values (If both are true, if both are false, and if only one is true).  Is there an easier way to do this?
 
The two sequences not shown are the (If both are true, if both are false).
 
Thanks for your help in advance.
Ron Deavers, CLD
0 Kudos
Message 1 of 9
(3,575 Views)
It looks like you need to test all of the comparisons every time, so you probably have to do it that way. You could also get rid of the sequence structure and run all of the comparisons at once.
 
If the cases are mutually exclusive, you could nest case structures to get your desired result. (I.e. a XOR b implies that one of them is true, if it is false you can use an AND to see if they are both true or both false.)
 
Hope this helps some.
 
0 Kudos
Message 2 of 9
(3,554 Views)
With not too much more work you could reduce this to a single case.  Use the two boolian inputs and build them into an array and then feed this into a boolian array to number function.  You will now have a number from 0 - 3.  0 of course is both off.  3 is both on.  And 1 or 2 would be any one of them as true.  Feed this to a modified case structure and set the cases accordingly... see picture for example.
 
 
Message 3 of 9
(3,542 Views)
That would certainly work also. I've been gone too long from the world of binary. 😉
0 Kudos
Message 4 of 9
(3,535 Views)
Just convert the two booleans to [0,1] and add them. The result can be fed to a case structure with three cases:
 
0: both off
1: one on, one off
2: both on.
 
See attached simple example (LabVIEW 7.0).
Message 5 of 9
(3,534 Views)
DOH Lol!
 
You show off!  Smiley Very Happy
I was just waiting for it also heheh
0 Kudos
Message 6 of 9
(3,521 Views)

Thank you for your responses.  That would work great altenbach, but the case in wich only one can be true must be for only one direction.

There should not be a case(or nothing should happen) if the top value is false and the bottom value is true.  This would be as if both values are false.

Thanks again.

Ron Deavers, CLD
0 Kudos
Message 7 of 9
(3,522 Views)


@programmindragon wrote:
There should not be a case(or nothing should happen) if the top value is false and the bottom value is true.  This would be as if both values are false.

Hah!!! Now that I made all this work, you're changing design specifications on me! 😮

We'll in this case use the approach by Chaos and create the four possible cases as desired. 🙂

Message 8 of 9
(3,518 Views)


@altenbach wrote:


@programmindragon wrote:
There should not be a case(or nothing should happen) if the top value is false and the bottom value is true.  This would be as if both values are false.

Hah!!! Now that I made all this work, you're changing design specifications on me! 😮

We'll in this case use the approach by Chaos and create the four possible cases as desired. 🙂



I think he is trying to disguise himself. he has to be my boss, changing design specs like that. Yep got to be my boss or dare I say the word.

Management.

Message Edited by jhoskins on 11-10-2005 05:55 PM




Joe.
"NOTHING IS EVER EASY"
Message 9 of 9
(3,502 Views)