05-23-2008 07:18 AM
If I have a numeric indicator, I can set it up (FORMAT & PRECISION) like this :
Precision type: Significant Digits #Digits: 5 Hide Trailing Zeroes: TRUE
This turns the value 1.234567 into "1.2345" the value 12.34567 into "12.346", the value 123.4567 into "123.46", and the value 12.3 into "12.3". The number of decimal places shown varies according to the number's magnitude.
How can I convert a number to a string using that same behavior? FORMAT INTO STRING gives me no options for significant figures, only decimal places.
None of the other number -- string functions do it either, that I see.
Am I missing something? Or do I have to roll my own?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2008 07:32 AM
05-23-2008 07:37 AM - edited 05-23-2008 07:38 AM
05-23-2008 08:07 AM
That option is not listed in the help for FORMAT INTO STRING, and I didn't think of extracting it from the dialog using ADVANCED EDITING.
Thanks.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2008 08:11 AM
Well, that just turns 1.234 into "1.234000". It defaults into 6 dec. places - no help.
When you don't succeed here, you can always check for ranges and use a different format code for each range of numbers...
Yeah, that's the "roll-my-own" I was hoping to avoid.
But the "%#_5g" code works!
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-27-2008 08:28 AM
07-10-2024 02:52 AM
Old thread but still a intresting subject.
I want to get rid of the # in the format specifier. When I have 999.333 as stimuli and wants 2 sign. digits I get 1E10^3. It should be 1.0E^3.
Without the # I get the latter one.
07-10-2024 04:31 AM
Hi Shakti,
@Shakti211 wrote:
You forgot to attach your subVI. (It's not magically included in the snippet!)
What's the point of the empty string constant?