12-06-2016 05:26 AM
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
Solved! Go to Solution.
12-06-2016 05:59 AM
12-06-2016 06:31 AM
The simple way to mask "irrelevants" is to AND them with FALSE. Then they will always be FALSE for your comparison.
12-06-2016 07:22 AM
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.
12-06-2016 07:41 AM
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?
12-06-2016 08:36 AM
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).
12-06-2016 03:25 PM
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.
12-06-2016 03:43 PM
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.
12-06-2016 03:52 PM - edited 12-06-2016 03:57 PM
12-06-2016 04:56 PM
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.