LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare two arrays (greater-equal) has wrong result. Bug?

Hallo,
in my attached example (LX 8.2) i have three arrays which are displayed in the graph.
As you can see the "Trace-plot" is below the "LowerLimit-plot".
In the code i do a "Trace >= LowerLimit" which should have the result = FALSE because its not always >=.
But the result is TRUE!!
 
Why??
 
All three arrays have 201 points
 
Thanks for your help
0 Kudos
Message 1 of 19
(3,618 Views)

It is only recording the last point saved from the comparison.  Try This:

Message Edited by Tom Haggerty on 12-04-2007 08:50 AM

 



Message Edited by Tom Haggerty on 12-04-2007 08:51 AM

 

Sorry about the hidden wires!  I just added the FOR loop very quickly and didn't clean it up.

 

Tom



Message Edited by Tom Haggerty on 12-04-2007 08:52 AM
0 Kudos
Message 2 of 19
(3,606 Views)
>It is only recording the last point saved from the comparison. 
 
But the last point is FALSE?
 
I found that when i right-click on the ">=" icon an set comparison-mode to "compare elements" then this icon returns an array with the result for each point.
Now its working.
thx for your help
Message 3 of 19
(3,591 Views)

"It is only recording the last point saved from the comparison"

I think no. It seems to make the comparison only for the first element.

I don't think this is normal...

Solution: swith to compare elements and see attach

0 Kudos
Message 4 of 19
(3,588 Views)
When you compare aggregates of an array, the comparison will be done on the first unequal pair. In this case it is the first element of the arrays, where trace[0] > lowerlimit[0]. This is why true is returned.

Tom's solution compares all the elements (although it could have been done without the for loop), and the comparison has to be true for every element for result to be true. However, it seems from your post you may want the comparison of only the last elements. Can you clarify exactly what you want the result LED to represent?

Edit: I guess I'm a slow typer. Glad you got it working.


Message Edited by Marc A on 12-04-2007 09:06 AM
0 Kudos
Message 5 of 19
(3,587 Views)

You are faster...

but the question still remains... looks like a bug....

0 Kudos
Message 6 of 19
(3,582 Views)
"

but the question still remains... looks like a bug....

"

Not the way I read it.

When doing the agregate flavor of th compare, only one of the comparisons has to be true to return a TRUE

So if any of the readings was above the lower that gate would return true. Similarly if any point was below the upper.... TRUE.

I'd use an "in Range" in loop or would AND the array returned by the "in Range" function.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 19
(3,572 Views)
>I found that when i right-click on the ">=" icon an set comparison-mode to "compare elements" then this icon returns an array with the result for each point.<
 
I didn't know about this feature.  Thanks!
Tom
0 Kudos
Message 8 of 19
(3,568 Views)

Ben wrote: "only one of the comparisons has to be true to return a TRUE"

But this returns false !

Seems to compare only the first element.. or i miss something?

0 Kudos
Message 9 of 19
(3,559 Views)
[quote]Seems to compare only the first element... [/quote]
 
This is what i would say too.
0 Kudos
Message 10 of 19
(3,548 Views)