LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I connect a Boolean array to a case structure?

Hi everyone, let's say I want to wire a 2*2 boolean array to a case structure, and execute events according to the (I don't know the exact term) but I'll go with coordinates of the elements in the array... e.g. if (0,0) is true do this, else...

So when I directly wire the array to the case structure, a broken wire appears indicating two different data types (array/element).

Any suggestions?

Thanks

T. A.
0 Kudos
Message 1 of 29
(9,404 Views)

 


e.g. if (0,0) is true do this, else...

You are going to use a case structure whose case is being selected by a boolean array. So each element in the array is going to have either a true value or a false value. So for all the elements you will have just two  cases, either true or false (in the case structure)!!! You can do this by simply wiring a boolean control instead of a whole array

Somil Gautam
Think Weird
0 Kudos
Message 2 of 29
(9,397 Views)

you cannot wire the array directly to the case structure. For wiring an array to the case structure, you need to extract the individual elements from the array.

 

See attached vi for clarification.

Somil Gautam
Think Weird
0 Kudos
Message 3 of 29
(9,393 Views)

Okay I knew I didnt make any sense, here's a rephrase, lets say this is the arraY

 

               B1  B2

               B3  B4

 

where B1, B2, B3 and B4 are all of Boolean nature, lets if B1 (0,0) is true and others are false, I want to do this or that... This is probably what I wanted to say earlier.

                                    

T. A.
0 Kudos
Message 4 of 29
(9,394 Views)

For a 1D array, you can use the boolean array to number primitive and then wire this number to the case structure. So true, false would be case 3...

 

Felix 

0 Kudos
Message 5 of 29
(9,393 Views)
Aha this solves a part of it, actually I thought of the array to cluster thingie earlier, but then again im not familiar with the unbundle, there are supposedly 4 elements in the 2*2 array, the unbundle function yields 2 I32 values, why? Second, why did you use the build array function?
T. A.
0 Kudos
Message 6 of 29
(9,392 Views)

Well Felix what if it's a 2*2 array? Plus I didnt get what you mean by "to number primitive"

 

Thanks

T. A.
0 Kudos
Message 7 of 29
(9,390 Views)

 


the unbundle function yields 2 I32 values, why?

The two I32 values are the dimensions of the array. since it is a 2X2 array, so both the I32 values are 2 and 2 (means 2 rows and 2 columns)

 

 


Second, why did you use the build array function?

 


I used the build array function? Really?? i didnt knowSmiley Very HappySmiley Very Happy
I think you are talking about the array to cluster conversion function or array size function

 

 

Somil Gautam
Think Weird
0 Kudos
Message 8 of 29
(9,388 Views)

ROFL :D:D it was my bad, I kinda read it through, anyway, why did we go through the array to cluster? And why did you add to for  loops?

Message Edited by toniaz on 24-11-2009 01:26 PM
T. A.
0 Kudos
Message 9 of 29
(9,387 Views)


why did we go through the array to cluster?


 

Because i wanted to extract the elements which were stored in the array. These elements will tell me the size of the main array. 

Somil Gautam
Think Weird
Message 10 of 29
(9,384 Views)