LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare aggregates produces wrong results?

Hi all,

I have the impression that the function "greater?" used to compare array in Compare Aggregates mode does not work as I exptect.

Referring to the attached image, I have two DBL arrays (data1 and data2) and for several indexes data2 is greater than data 1 (for example index 60).

When data1 is compared with data2, result is TRUE (data1 is greater than data2).

Does comparision results in aggregate mode are processed in OR? I though they were performed in AND.

 

 

aggregTest.png

0 Kudos
Message 1 of 3
(1,999 Views)

@AC_85 wrote:

Does comparision results in aggregate mode are processed in OR? I though they were performed in AND.


It's fairly natural to expect the AND, but it's not that, and it's not OR. The values are compared in order and the function will stop with the first element that's not equal and use that as the result. This is like comparing names in a phone book or a dictionary, where you compare letters until you find the first that isn't equal.

 

There's a topic in the online help which goes into some more details about comparisons, but you have to click through a couple of links to get to it.


___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(1,988 Views)

Aha, another LabVIEW "forgotten tidbit".  I'd forgotten about Aggregate Mode, which I think of as "Short-Circuit Mode" (as it has the potential to stop comparing two million-element arrays as soon as it gets the first "deterministic" compare).  Thanks for reminding me of this Shortcut.

 

Note that you can do a non-aggregate Compare, then follow it with the Universal (Array And, whose symbol is Symbolic Logic's Universal character) or Existential (Array Or) operator to determine if "All are True", Universal, or if "At least One is True", Existential.

 

Bob Schor

0 Kudos
Message 3 of 3
(1,961 Views)