12-09-2011 09:38 PM
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
01-10-2023 06:55 AM
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.
01-10-2023 11:20 AM
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.
01-10-2023 03:36 PM - edited 01-10-2023 03:44 PM
@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...
01-12-2023 04:42 PM
@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.
01-12-2023 04:51 PM
@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.
05-23-2024 07:34 AM
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?
05-23-2024 08:40 AM
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
05-23-2024 09:14 AM
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.
05-23-2024 09:25 AM
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.