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?
Solved! Go to Solution.
The simple way to mask "irrelevants" is to AND them with FALSE. Then they will always be FALSE for your comparison.
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.
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?
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).
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.
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.
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.