09-01-2022 09:53 AM
@JÞB ha scritto:
@Basjong53 wrote:
.
The standard notation is 3.14 kHz (with a space between the number and prefix), which isn't natively supported. So for frontpanel indicators needing a unit I almost always use this vi that formats it correctly.
Nope, Mathematically it is 3.14*1000*Cycles/Second or "3.14kHz" where "*" is implied the space breaks the math.
@JÞB
I know you like to be pendantic and always right, but you're wrong here. The official International Bureau of Weights and Measures states that you add a space between the value and unit: https://www.bipm.org/en/publications/si-brochure
@crossrulz
Yeah, maps probably will improve performance, but I've made this vi before maps were added. I guess this is a good time to update it 😉
09-01-2022 09:54 AM - edited 09-01-2022 09:58 AM
@paul_cardinale wrote:
"%.2{Hz}p" works, but has the drawback of only working for frequency.
With what are you getting that to work? I just get errors with everything I've tried so far (Format String, Scan From String, control's display format).
EDIT: Ahh, your example showed me the part I was missing. Units have to be attached to the numeric data.
09-01-2022 10:08 AM
@Basjong53 wrote:
It's a pet peeve of mine, but I always disliked how to add units to numbers on frontpanel indicators. It's either 3.14kHz (%.2pHz) or 3.14k Hz (%.2p Hz).
The standard notation is 3.14 kHz (with a space between the number and prefix), which isn't natively supported. So for frontpanel indicators needing a unit I almost always use this vi that formats it correctly.
I like this one a lot. I worked on a project a few years ago in which one of the non programmer product leads demanded that all number indicators on the UI MUST be numeric types and not strings (which was extra work because we were getting nicely formatted strings with units from the hardware). So we made the UI and all the indicators were numeric and had SI units but he took a look and said; "No, that's not how it is supposed to look, there needs to be a space between the number and the unit!" So we said this would sure be a lot easier if we could use strings for the indicators but he was not going to budge on the data type so we ended up having the caption for the indicator be to the right of the indicator and it displayed the units in the caption and he liked that.
09-01-2022 12:05 PM
@Basjong53 wrote:
@JÞB ha scritto:
@Basjong53 wrote:
.
The standard notation is 3.14 kHz (with a space between the number and prefix), which isn't natively supported. So for frontpanel indicators needing a unit I almost always use this vi that formats it correctly.
Nope, Mathematically it is 3.14*1000*Cycles/Second or "3.14kHz" where "*" is implied the space breaks the math.
@JÞB
I know you like to be pendantic and always right, but you're wrong here. The official International Bureau of Weights and Measures states that you add a space between the value and unit: https://www.bipm.org/en/publications/si-brochure
Well, 1 Kudos for that! I'll be right next time