LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing boolean arrays

Solved!
Go to solution

Hi,

I am trying to compare a 1D boolean array with each row of a 2D boolean array. The comparison is working well, but now i need to declare some values as irrelevants and i don't know how to do that. Any suggestion?

thanks

0 Kudos
Message 1 of 12
(2,536 Views)

Hi rlages,

 

i need to declare some values as irrelevants

Can you provide a definition of those "irrelevants"?

 

When those items are irrelevant you should not use them to calculate your final result…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 2 of 12
(2,518 Views)

The simple way to mask "irrelevants" is to AND them with FALSE.  Then they will always be FALSE for your comparison.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 12
(2,506 Views)

I can't send the vi but i'll try to explain:

i have several valves and each combination of valves positions represents a state of my "machine". So, i have build a 2d array with all possible combinations and i compare each row of this array with an array of the current possition of my valves. The problem is that, for some states of my machine, some valves position are irrelevant, but for the others states are not, so i can't suppress this boolean because it is not irrelevant all the time.

0 Kudos
Message 4 of 12
(2,496 Views)

What do you want the result of the comparison to be if they are irrelevant?  Do you want the result to be True or False?  Are you doing something like AND all array elements or OR all array elements on the 1-D comparison to get a final True or False?

0 Kudos
Message 5 of 12
(2,490 Views)

rlages wrote:The problem is that, for some states of my machine, some valves position are irrelevant, but for the others states are not, so i can't suppress this boolean because it is not irrelevant all the time.

Nothing said your mask had to be a constant.  You could have a 2D array (to match your original array) that has a TRUE with the flags you care about.  Then you just do an AND.  Your state machine can change which flags are relevant at different times (store in a shift register).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 12
(2,476 Views)

I am sending to you an example of my problem with a description in the block diagram.

It is important to remeber that in the real case i have much more valves to check.

I know that possibly there are better ways to implement my VI but i am just a begginer and i thank you all for the patience.

0 Kudos
Message 7 of 12
(2,445 Views)

Easiest thing would be to define another State 3 that also has Valve 2 as False.

The rest of the code can also be simplified.

0 Kudos
Message 8 of 12
(2,442 Views)
Solution
Accepted by topic author rlages

try something like this:

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 12
(2,438 Views)

I understood what you did, but as i said, in my case i have much more valves and much more states, so, if i implement you suggestion my true table will increase exponentially.

0 Kudos
Message 10 of 12
(2,421 Views)