LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with comparing negatives and positive values

Solved!
Go to solution
Well guys I make this example to show you what i'm talking about

 

fine.JPG

 

With this example I can get positives and negatives numbers in Numeric

But for me, the "minus" don't mean anything

Example:

If I have "100 -200" for me the greater value is -200

but if I compare bouth values I received 100 as greater value

 

I do the same calc for 3 differents variables like A, B, C

and after that I have to calc which value is the "greater"

 

But my problem is, If I have the values "-350 300 -400"

the greater will be "300" but for me the "minus" don't mean anything

so I need the greater value is "-400"

 

For all positive values, its works fine!

I compare A and B, after that the greater is compared with C and have a result!

 

but When I have negative values and positive values... I got that problem...

and When I have only negative values I have a problem too. 

"-300 -400 -500" for me the greater value have to be "-500" but labview shows "-300"

because -300 is greater than -500 in algebriac.

 

And If I use absolute values I will always have a positive value... but I need to know if the value is negative or positive

 

Anyone, can help me with that?

 

Thanks

0 Kudos
Message 1 of 13
(4,770 Views)
I suggest you do your comparison with the absolute values of the numbers. That should return the result you want.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 13
(4,764 Views)
Solution
Accepted by EduU

Max_Min.PNG

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 13
(4,759 Views)

Yes, I already do it with absolute values

but If the "greater" value is the negative one.. I need to know that

so I have to find a way that it shows me if the number is positive or negative

 

I have "300 400 -500" with absolute values I will receive 500 as greater value

but the real greater value is -500 not 500

 

Thanks

0 Kudos
Message 4 of 13
(4,753 Views)

Ok all,

How about this.  Ahhh.png

 

it returns just the magnitude not the nasty sign that is meaningless to the OP

Message Edited by Jeff Bohrer on 10-29-2009 11:30 AM
Message Edited by Jeff Bohrer on 10-29-2009 11:30 AM

"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 13
(4,747 Views)

EduU wrote:

Yes, I already do it with absolute values

but If the "greater" value is the negative one.. I need to know that

so I have to find a way that it shows me if the number is positive or negative

 

I have "300 400 -500" with absolute values I will receive 500 as greater value

but the real greater value is -500 not 500

 

Thanks


Please look at that sample code again.

 

Max_Min.PNG 

 

The abs value is just used to decide which element had the largest magnitude. I then index out the original value as per your desire.

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 13
(4,725 Views)

Well Jeff, this way still gives me only positive values

because x² make any negative number positive

 

I will try explain my point again

 

I have to get the greater number even the number is negative

and when i have that number i have to plot it with the signal

 

Like I have 5 numbers "100 144 -155 -200 -298"

The greater number is 298

so I have to plot it like: -298

 

If I use absolute values, ok i will find 298... but I will think it is a positive values

when it is a negative value

 

Now you guys understand me?

 

0 Kudos
Message 7 of 13
(4,715 Views)
Ben's solution does that
Message Edited by Harold Timmis on 10-29-2009 12:43 PM
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 8 of 13
(4,708 Views)

Well the Ben explain is right..

sorry at the first time I saw I missunderstood it.

 

Really apreciate that... I thought for like 2 hours and don't figure out any way to do that

and you did it in 10 seconds haha

 

Thanks

Message Edited by EduU on 10-29-2009 11:47 AM
0 Kudos
Message 9 of 13
(4,703 Views)

EduU wrote:

Well the Ben explain is right..

sorry at the first time I saw I missunderstood it.

 

Really apreciate that... I thought for like 2 hours and don't figure out any way to do that

and you did it in 10 seconds haha

 

Thanks

Message Edited by EduU on 10-29-2009 11:47 AM

10 seconds after 11 years of practice. Smiley Tongue

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 13
(4,684 Views)