LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

format specifiers in format string param.

I use the format specifier %.8e to format a single precision 2D array into
an ASCII file, and i wanted to know what other types of format specifiers
i can use. But the help or the manual does not tell which types are valid.
Where can i find out? -or can anyone tell me?
(i use LabVIEW 6.i)



sincerely
/lodahl





% Best regards;Brian Lodahl ; lodahl@kom.auc.dk
% http://www.kom.auc.dk/~lodahl ; RISC group 850;Room A6-118;
% RF Integrated Systems & Circuits (RISC);Aalborg University;
% Frederik Bajers Vej 7;DK-9220 Aalborg Ø;Denmark
clc;s=zeros(1,52);c=[+'a':+'z',' '];f=5;a=clock;a=fix(f*a(6));
while(1)while(1)b=clock;b=fix(f*b(6));if(b~=a)break,end,end,a=b;
str=('my name is brian and i am just another matlab hacker');
k=find(s~=s
tr);n=length(k);if~n,break,end;x=c(ceil(27*rand(1,n)));
s(k)=x;fprintf('\r%s',s);end;fprintf('\n');clear%;clc;str
0 Kudos
Message 1 of 8
(5,624 Views)
LabVIEW help has quite a bit on format specifiers. If you go to the help index and type format specifiers, you'll find examples, syntax, and syntax elements that should help you get started.
0 Kudos
Message 2 of 8
(5,623 Views)
Yes, this is a big bug with the documentation. Just about everywhere you look in LabVIEW help, it refers you to the LabVIEW manual to find the format specifiers, yet they aren't there.

Having gone down this road many a time, I will make the following recommendation:

Go to Help>>Index
Type in "formatting"
Select "specifier in strings" under "Formatting"

This will produce the Format Specifier Table

There are examples under "Format Specifier Examples" as well.
0 Kudos
Message 3 of 8
(5,623 Views)
Not being a C programmer (the format specifiers were originally a C tool that LabVIEW inherited), the way that I learned them was to use the Edit Format String dialog that is available by right-clicking on the Format Into String function and the Edit Scan String dialog that is available by right-clicking on the Scan From String function. You can make your formatting choices and see the resulting format specifier.

But remember... reverse engineering is a violation of section 3 of your LabVIEW software license agreement 😉

-Jim
Message 4 of 8
(5,623 Views)
Jim,

Oops, I forgot about this little hidden feature. Thanks for recommending this. I would have never remembered, and I just used the darn thing the other day.

I can't remember where I saw the answer, but I was looking for a way to convert iterations of a loop into multiple digit numbers with leading zeroes. I ended up in the Edit String Scan, and that may have been where I found it.

Great tip!
Message 5 of 8
(5,623 Views)
To this day, when creating format specifiers for functions like Array to Spreadsheet String, I will still open those dialogs to make sure I am using the right format specifier.
0 Kudos
Message 6 of 8
(5,623 Views)
This problem has been corrected in the LabVIEW 6.1 Help, which you can access by selecting Help»VI, Function, & How-To Help.
Kelly H
LabVIEW Documentation
National Instruments
0 Kudos
Message 7 of 8
(5,623 Views)
Kelly,

It would also be useful for NI to make the "Edit Format String" dialog tool available from all functions or VIs that use format strings; for example, the Array to Spreadsheet String and Spreadsheet String to Array functions, and the Write to Spreadsheet File.vi and Read from Spreadsheet File.vi VIs. Yes, it is probably tricky for NI to add it to VI's that use format strings, but it should be a piece of cake to add it to functions.

-Jim
0 Kudos
Message 8 of 8
(5,623 Views)