10-13-2020 12:27 PM - edited 10-13-2020 12:33 PM
Dear All,
I am trying to compare two Bool-Arrays (13 T/F values each) from which 4 are allowed to be T or F. I have to do that for four cases.
Up until now I have only found a work-around by using permutations or a very large 2D-Array.....which are both a real pain in the neck.
Is there a possibility to define a bool constant that can be T or F?
The array in the example only has 8 values of which 3 are allowed to be T or F. Now I have to expand this to 13/4.
Thanks for your help.
Ralf
Solved! Go to Solution.
10-13-2020 12:36 PM - edited 10-13-2020 12:39 PM
Hallo Eisbein,
@Eisbein wrote:
I am trying to compare two Bool-Arrays (13 T/F values each) from which 4 are allowed to be T or F.
Simple like that:
This will work for "any" array length (less then 2^15 elements and both arrays of same length) and any limit…
I'm not sure I got your requirement correctly. Anyway: when working with boolean data you can use all those boolean functions to ease the solution!
@Eisbein wrote:
Is there a possibility to define a bool constant that can be T or F?
A boolean value will always be TRUE or FALSE…
10-13-2020 01:23 PM
Thanks, Gerd.
I know where you're coming from. Neat! But where some of the values don't matter if T or F, some do.
Sometime you just have to let go.
I've just re-built the array I want to compare to the values that matter.
That seems to work.
Ralf
10-13-2020 01:43 PM
Hi Eisbein,
@Eisbein wrote:
But where some of the values don't matter if T or F, some do.
So for example you want to test an array like TFTFXXTFTF, where two elements marked "XX" aren't relevant?
Use boolean functions like AND/OR to mask those bits, then you can use == (or <>) to compare your arrays!
You really should attach a VI containing example data and the expected output…
10-13-2020 02:40 PM
@Eisbein wrote:
Thanks, Gerd.
I know where you're coming from. Neat! But where some of the values don't matter if T or F, some do.
Sometime you just have to let go.
I've just re-built the array I want to compare to the values that matter.That seems to work.
Ralf
Is this some sort of joke?
Why not just hardcode the "Right" answer?
Seriously, you want to compare 13 pairs of true false elements and some of the values just don't mean anything.....
North Dakota, move to North Dakota. There is ample room between residents there and BONUS no Capital Punishment.
10-13-2020 02:56 PM
As I said....I have to do this with several cases where the T/F that matter change position, and I have to do this within quite a few arrays.
A built-in function T/F instead of T or F within an array would have helped. In a single line for one value, a walk in a park, but within an array?
You don't like my question?......just don't reply!
You can't give a solution, a hint or an answer?........do the same!
R.
10-13-2020 03:03 PM - edited 10-13-2020 03:04 PM
It's because your not making sense. True is TRUE. False is FALSE. It's either one or the other. It can't be "when it feels like it."
We really need to see some example data of what data comes in and what you expect the answer to be. Upload your VI with data in your controls and set them to the default values, save the VI, and then import it here.
10-13-2020 03:30 PM
The correct way to handle "TRUE/FALSE/DON'T CARE" is to use a mask, as GerdW mentioned. If you have arrays of Booleans like in your picture, use an array of masks.
10-13-2020 04:37 PM
Sometimes it matters, sometimes it doesn't, and that's exactly what I have here.
A VI does make little sense, but I have inluded one so that you see what I mean.
To control different features of a drive through OPC/Profi some measurement values need to be true, some don't. The positions are fixed, but change with each case.
Some would say, if it doens't matter just put in F or T, but I need a [T] after the comparison, no matter what F/T value the measurment gives.
If Labview had an [ignore] value like the TIA/Siemens everyting would be fine, and that is exactly my question.
10-13-2020 05:04 PM
As others have said, you need an array to mask the results that you don't care about.
Then simple boolean operations handle the rest.
See attached.