ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
10-26-2019 11:47 AM
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
10-27-2019 02:54 AM
We can help better if you attach the VI instead of a truncated picture.
10-27-2019
07:28 AM
- last edited on
05-14-2025
07:53 PM
by
Content Cleaner
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.
10-27-2019 10:28 AM
Another option is to use an equal operator with the other input wired to a compatible constant!
10-27-2019 10:37 AM
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.
10-27-2019 11:04 AM
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!
Yes, compare with a zero in the correct units instead. If you just remove units, you might not get what you expect.
10-28-2019 06:54 AM
@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.
10-28-2019 05:25 PM
@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.