LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparison with Units

I'm trying test if the number that is input is greater than 0, however, because I attached a unit to the control the comparison is not allowing me to connect the wires. Is there a way to strip the unit off to do the comparison or is there another way I can do a comparison with a value that has units associated with it.

Thanks

0 Kudos
Message 1 of 8
(3,078 Views)

We can help better if you attach the VI instead of a truncated picture.

0 Kudos
Message 2 of 8
(3,072 Views)

You can remove units using the Convert Unit function.  This article will probably help:
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/errors/unit-conflict.html

 

In your case, I believe you would add the Convert Unit function before the greater than 0 comparison. Enter "m" into the function and that will remove the units.

0 Kudos
Message 3 of 8
(3,038 Views)

Another option is to use an equal operator with the other input wired to a compatible constant!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 8
(3,016 Views)

Is there a reason you are even using units?

 

Units are a feature that NI added to LabVIEW years ago but there are so many quirks to them that the hassle outweighs the benefits.

0 Kudos
Message 5 of 8
(3,013 Views)

As Rolf already hinted the "zero" in ">0" does not have units so the comparison is not allowed for you sanity. Imagine you have a temperature, would 0 to be compared be in kelvin, fahrenheit or celsius? The program cannot know!

 

units.png

 

Yes, compare with a zero in the correct units instead. If you just remove units, you might not get what you expect.

 

 

 

0 Kudos
Message 6 of 8
(3,002 Views)

@RavensFan wrote:

Is there a reason you are even using units?

 

Units are a feature that NI added to LabVIEW years ago but there are so many quirks to them that the hassle outweighs the benefits.


I disagree.  There are some quirks, but overall, I find units useful.  I use units on a control that represents a physical quantity and is on the connector pane.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(2,978 Views)

@paul_cardinale wrote:

@RavensFan wrote:

Is there a reason you are even using units?

 

Units are a feature that NI added to LabVIEW years ago but there are so many quirks to them that the hassle outweighs the benefits.


I disagree.  There are some quirks, but overall, I find units useful.  I use units on a control that represents a physical quantity and is on the connector pane.


I use units when I want to concentrate more on the manipulation of the data than what the data actually is.  For instance, if I'm using a formula that involves Hz, I don't want to worry what the incoming number is.  If my formula uses Hz and the incoming number represents GHz, I add the appropriate unit and that's that.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(2,949 Views)