LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing unit label before storing number in an array

Solved!
Go to solution

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.

0 Kudos
Message 1 of 7
(925 Views)
Solution
Accepted by BeeEyeBye

Hi Bee,

 

you may try CastUnitBases:


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(906 Views)

@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.

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 3 of 7
(902 Views)

@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.

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 4 of 7
(896 Views)

Thanks for the help!

0 Kudos
Message 5 of 7
(827 Views)

Thank you!

0 Kudos
Message 6 of 7
(822 Views)

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.

0 Kudos
Message 7 of 7
(789 Views)