LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conditions structure from multiples booleans

In order to set conditions from multiples booleans, I usually do this:

Sans titre.png

 

 

 

 

 

 

 

 

Do you know if there is there a better solution, I mean: faster to program and easyier to understand for other people??

Pierre FCentum TNS, Grenoble
Certified LabVIEW Associated Developer
0 Kudos
Message 1 of 6
(2,454 Views)

I'd say that is pretty straightforward.

 

If most values are unique, you can also use the integer as in index to an array. So, make an array constant, and use Index Array with the 2th complement value. That would be better, as you'll have overview (no need to select a case to see the value). The array of enums would require an array constant with a cluster holding the array of enums if the size of the array isn't always 2. If it is always 2, you can use a 2D array of enums.

 

Of course if the resulting values are a combination of the 3 Booleans, three separate selectors might be possible. But I guess you would have used that if it that was the case.

0 Kudos
Message 2 of 6
(2,441 Views)

Can you place your buttons into Radio buttons container?
In this case you will operate with enum, and it's much more easier to understand.

Another case to use Event structure. You really no need to check another buttons if you make changes in one of them. So one button -> one event case.

0 Kudos
Message 3 of 6
(2,437 Views)

It's clearly two's complement, so radio buttons are out.

 

If it wasn't two's complement (there would only be 4 options), a radio button would be useful.

0 Kudos
Message 4 of 6
(2,426 Views)

Hooovahh is always making fun .VIMs for the community, so let me try this one:

2018-08-31_18-01-38.png

 

You give it a cluster of booleans and it returns a typedef'd enumeration that can be passed to a case selector.  This mimics what you're doing... it's just slightly cleaner through use of an enumeration.  No need to spend brainpower on binary case selector math.

 

.VIM looks like this on the inside:

2 booleans2 booleans3 booleans3 booleans

0 Kudos
Message 5 of 6
(2,384 Views)

oh, and in case it wasn't clear, user code would look like this:

2018-08-31_18-11-17.png

0 Kudos
Message 6 of 6
(2,383 Views)