LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

%.3f and %6.7f, what are these codes mean?

hi,
 
appreciate if someone can tell me those programming codes mean.
i am totally not familiar with programming codes.
 
thanks.
0 Kudos
Message 1 of 6
(41,254 Views)
hello,

You can find this explanation if you see the help of some vi that uses it. Like "format into string".

%[$][-][+][#][^][0][Width][.Precision || _SignificantDigits][{Unit}][<Embedded information>]Conversion Code

where Width must be a number greater than zero and .Precision and _SignificantDigits must be a number greater than or equal to zero.

For functions that scan a string, such as Scan From String and Spreadsheet String to Array, a format specifier uses the following simplified syntax elements.

%[Width]Conversion Code


%6.7f-
   f - float
   6 - width
   7 - precision

But it's best if you search the help for "Format Specifiers ". Then you can see examples.

Software developer
www.mcm-electronics.com





PORTUGAL
Message 2 of 6
(41,245 Views)
And here's an internet link:
Format Specifier syntax

Ton

PS don't use a PPT to post images, a PNG will do!
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 6
(41,241 Views)

The number after the Decimal point in the format specifier points to the No of digits of precision required in the display. I dont know about the value preceeding the decimal in the Format Specifier field. It seems not to take any effect on the left side of the decimal point.

See the Help for more details on the various Format Specifiers.

See the attached screenshot.

- Partha ( CLD until Oct 2027 🙂 )
Message 4 of 6
(41,240 Views)
The value before the decimal point is the width, as is clearly explained in Jorge's full answer to the question.
0 Kudos
Message 5 of 6
(41,227 Views)

Remember that in, for example, %6.7f the 6 represents the MINIMUM field width. The width will be expanded if necessary. In this case expansion of the width is needed as the result has a decimal point with 7 digits after it and at least 1 before, so %9.7f would give the same result.

 

In 8.20 (and possibly earlier revs) you can place a 'format into string', and double click on it to get a dialogue.

 

 

Message 6 of 6
(41,216 Views)