LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

True and False - Possible Combinations

Solved!
Go to solution

Hello

 

I have three booleans in my code and the combination of their values (true or false) control another part of the code. Since there are three booleans and they can be true or false, I have 8 possible combinations (2^3). What should I do to, considering the values of the three booleans, have a numeric indicator that show which combination I have? The range of the numeric indicator will be 1 to 8.

 

Thanks in advance

 

Daniel

 

0 Kudos
Message 1 of 6
(15,639 Views)
Solution
Accepted by topic author dan07

Create an array and then use the Boolean Array to Number.

 

Booleans to Number.PNG

Message 2 of 6
(15,632 Views)
Perfect solution! Sorry for the stupid question! Smiley Happy
 
Thanks!
Message Edited by dan07 on 08-04-2009 06:55 PM
0 Kudos
Message 3 of 6
(15,627 Views)

I have one more question. I would like to convert these 8 combinations to 0 and 1 combinations. Considering 0 as false and 1 as true, we will have 8 combinations like this:

 

000

111

110

011

010

100

001

101

 

What code should I use to generate, for example, a array with these sequences? One sequence as each element of a string array, for example.

 

Thanks.

 

0 Kudos
Message 4 of 6
(15,618 Views)

Like this?

 

Message Edited by altenbach on 08-04-2009 05:29 PM
Message 5 of 6
(15,612 Views)

Exactly!

 

Thanks!

0 Kudos
Message 6 of 6
(15,606 Views)