LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do very few programmers use LabVIEW unit labels

Albert,

 

Thank you for posting the Idea.  This is one of those things which would be very useful if done correctly.  As currently implemented it has problems which certainly contribute to the limited usage.

 

Lynn

0 Kudos
Message 21 of 38
(2,561 Views)

I stumbled across unit labels and find them very useful.  The units on our instrument range through nS, uS, mS and S.  Unit labels take care of it all automatically.  It saves a lot of work. 

0 Kudos
Message 22 of 38
(1,907 Views)

For anyone else stumbling across this thread, many of the unit bugs have been resolved.  For instance, the one mentioned early in this thread where the "Square" node didn't change the units to be squared is now no longer an issue (since at least LabVIEW 2018, not sure of the exact release that fixed it).

 

One other thing to note:  One of the reasons why attaching unit labels to floating point wires was irritating was that it made it harder to create reusable "math" code.  For instance, if you wanted to make a subVI that took in an array of doubles and calculated the statistical distribution, you would have to make it once for each different unit type.  However, now that there are Malleable VIs, it is possible to create "math only" VIs that work no matter what units you provide to them.

Message 23 of 38
(1,873 Views)

@BeeEyeBye wrote:

I stumbled across unit labels and find them very useful.  The units on our instrument range through nS, uS, mS and S.  Unit labels take care of it all automatically.  It saves a lot of work. 


You are looking in the wrong place. The secret (and pain point!) of units is mostly in the math, not in cosmetics. If your value is in S, just set the display format to e.g "%.3pS" and the rest will fall into place! No units or unit labels needed. Try it! 

 

Examples:

Value=1.2, display="1.2S"

Value=0.0012, display="1.2mS"

Value=1200, display="1.2kS"

Value=1.2e-9, display="1.2nS"

Etc...

Message 24 of 38
(1,845 Views)

@altenbach wrote:

@BeeEyeBye wrote:

I stumbled across unit labels and find them very useful.  The units on our instrument range through nS, uS, mS and S.  Unit labels take care of it all automatically.  It saves a lot of work. 


You are looking in the wrong place. The secret (and pain point!) of units is mostly in the math, not in cosmetics. If your value is in S, just set the display format to e.g "%.3pS" and the rest will fall into place! No units or unit labels needed. Try it! 


I do wish, though, that "uS" could be displayed as "µS", whether using units or formats.

 

There is one small issue when using formats in a control (though you're describing an indicator). If the "unit" in the display format is also an SI prefix (m, T, P, u or a), then entering some values behaves differently from when this is not the case:

e.g., set the format to "%#.3pm" for meters. Then entering

"5" gives "5m"

"5k" gives 5km"

"5u" gives "5um"

but both "5m" and "5mm" give "5m", not "5mm" (whereas for units "m/s", "5m" gives "5mm/s")

 

Unlikely to ever be a problem, but worth being aware of.

Message 25 of 38
(1,717 Views)

@GregSands wrote:
Unlikely to ever be a problem, but worth being aware of.

Yes, my typical use is for indicators, so this is not an issue.

Message 26 of 38
(1,731 Views)

I'm also only discovering units (wth). For now my main use would be mostly for indicators: displaying A in mA instead, for a bunch of indicators at once and avoiding to do a case structure with various manual multiplications. 


@altenbach  a écrit :

 

The secret (and pain point!) of units is mostly in the math, not in cosmetics. If your value is in S, just set the display format to e.g "%.3pS" and the rest will fall into place! No units or unit labels needed. Try it! 

 

Examples:

Value=1.2, display="1.2S"

Value=0.0012, display="1.2mS"

Value=1200, display="1.2kS"

Value=1.2e-9, display="1.2nS"

Etc...


If I understand well what you said, a wire or indicator still need to have a unit label before (programmatically) changing the display format?

I've been testing stuff that don't seem to work, unsure why, and I don't find the help page helpful at all....

Simply connecting a Random Number (and assuming that generates a value in A) and connecting it to an indicator, I'd like to change the display of this indicator programmatically to either mA; uA etc. Changing only the display format doesn't seem to work, it just displays the same number with a different text at the end.

Playing with Unit Label Property node works though. What do you recommend?

 

VinnyAstro_0-1716467599366.png

VinnyAstro_1-1716467615417.png

 

0 Kudos
Message 27 of 38
(884 Views)

Try %.6pA for lolz. The p format specifier is a special format specifier like f, e, d and others and means to use the SI Notation format

Rolf Kalbermatter
My Blog
0 Kudos
Message 28 of 38
(872 Views)

I'm also a fan of using the SI notation for my controls, indicators, and constants.  I even made a tool (Quick Format) to make it simple since I do it so much.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 29 of 38
(864 Views)

I use them when I need to convert a pure number into a unit for calculating something, but it always gets converted back to a pure number before it gets used again.

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 30 of 38
(857 Views)