ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

control case structure with bolean

Solved!
Go to solution

hello everyone i have some problem with my .vi. in this case i want to makes 3 case with control bolean. in this first case if i click the button of 3 member in case "0" can send the string from bolean to write in the visa, then second  if i click the button of 5 member in case "1" can send the string from bolean to write in the visa and the last  if i click the button of x member in case "2" can send the string from bolean to write in the visa. but for now i have some problem if i click 3 member in case "0" and x member in case "2" why the string to in case is always 0 but before to case the value of string can display. but for button of 5 member in case "1" its normal. what wrong about that ? does this have an effect because of the election Boolean To (0,1)  and Compound Arithmetic. do you have for solution ? thank you for advance

 

mamprat_0-1643637514999.png

 

0 Kudos
Message 1 of 7
(2,620 Views)

Hi mamprat,

 


@mamprat wrote:

i have some problem with my .vi.

do you have for solution ?


We will give (good) suggestions as soon as you attach any code.

We cannot debug/edit/run images with LabVIEW!

 


@mamprat wrote:

in this first case if i click the button of 3 member in case "0" can send the string from bolean to write in the visa,

if i click the button of 5 member in case "1" can send the string from bolean to write in the visa

if i click the button of x member in case "2" can send the string from bolean to write in the visa.

but for now i have some problem if i click 3 member in case "0" and x member in case "2" why the string to in case is always 0 but before to case the value of string can display. but for button of 5 member in case "1" its normal.


I really don't understand what the problem is… (Some real code might help.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,614 Views)
Solution
Accepted by topic author mamprat

That integer can only be 0 or 1.

 

If one of the Booleans is true, it becomes a 1. Orring 3 1's will still be 1.

 

The only way the integer becomes 0 is if none ogf the Booleans is true.

 

Put the integers in an array, and use Boolean Array To Integer.

 

Or add the Booleans, so the first is added once, the 2nd 2 times, and the 3rd 4 times. This resulTs in a 2th complement of the values.

wiebeCARYA_0-1643639189945.png

 

 

0 Kudos
Message 3 of 7
(2,606 Views)

sorry sir, i forgot to add my vi. this is my vi and my rules 

0 Kudos
Message 4 of 7
(2,601 Views)

i follow the concept from this videos, and the result is not problem. but may i try apper the problem sir

https://www.youtube.com/watch?v=8w_yK1PhIKc

mamprat_0-1643639856494.png

 

0 Kudos
Message 5 of 7
(2,598 Views)
Solution
Accepted by topic author mamprat

@mamprat wrote:

i follow the concept from this videos, and the result is not problem. but may i try apper the problem sir

https://www.youtube.com/watch?v=8w_yK1PhIKc

mamprat_0-1643639856494.png

 


Note that they use a +, not an OR.

 

So, they will get:

F F F -> 0

F F T -> 1

F T F -> 1

F T T -> 2

T F F ->1

T F T -> 2

T T F -> 2

T T T -> 3

 

This, to me, only makes sense if 1, 2 and 3 are clicked on and off in the right order. Or for an example...

 

You'd usually try to handle each Boolean individually, avoiding 2^n cases, if that's what you want.

0 Kudos
Message 6 of 7
(2,578 Views)

I've found the problem, I'm seeing the wrong symbol in the boolean. Thank you for the advice

0 Kudos
Message 7 of 7
(2,574 Views)