01-10-2023 06:49 AM
Hello. Is there a way to remove the unit label from the output of a numeric control? I need to store the number from a numeric control in an array and LabView gives me an error message. Thanks for any help.
Solved! Go to Solution.
01-10-2023 07:23 AM - edited 01-10-2023 07:25 AM
01-10-2023 07:25 AM
@BeeEyeBye wrote:
Hello. Is there a way to remove the unit label from the output of a numeric control? I need to store the number from a numeric control in an array and LabView gives me an error message. Thanks for any help.
In the numeric --> conversion palette, you find the "convert unit" node which either cast your pure number to a unit, or the opposite if used on a number with a unit label already. See the help for the details.
01-10-2023 07:28 AM
@GerdW wrote:
Hi Bee,
you may try CastUnitBases:
I think it is better to use Convert Unit function. The help for Cast Unit Bases seems to agree.
01-18-2023 10:51 AM
Thanks for the help!
01-18-2023 10:53 AM
Thank you!
01-18-2023 03:30 PM
For what it's worth, the reason you should use "convert unit" instead is because sometimes the "base" unit isn't what you think it is.
One primary example is that temperature units are stored in Kelvin, so if you try to convert 25C in that way then you get 298.15, which may not be what you would expect.
Another is weight. You might think the base unit is grams, since it's the unit with no prefix, but NI uses SI units as the base, and the SI unit for weight is the kilogram, so your 2500 gram numeric turns into a "base unit" of 2.5.
There's probably other cases out there too. Best to always explicitly convert.