LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write array to text file

In the format input of the write to spreadsheet file you need to include the following string: %#g

 

Capture.PNG

(the default will only save to three decimal places)

Message 11 of 16
(2,243 Views)

Hello All;

Many thanks to all of you and especially to Phil because it works and by using write to spreadsheet.vi with transpose "T"; I got the array in one column within .txt file. Dear members; by applying %#g I got 6 digit precision after the decimal point. Is it possible to increase the number of digits after the decimal point?

Secondly Labview uses ',' for indicating the decimal point where as MATLAB uses '.' is it possible to convert the ',' into '.' while saving the data into .txt file because I need '.' to represent the decimal point. 

 

Once again thanks to all Smiley Happy

 

Regards

Attique Ur Rehman

0 Kudos
Message 12 of 16
(2,223 Views)

Hi attique,

 

do you ever care to read the context help? Especially for the format codes you're asking for?

 

Ever wondered why you get 6 digts after decimal point for a format code of "%#6g"? Ever tried with "%#12g"?

After reading the context help you would also try a format code like "%.;%#12g" without asking the forum for such simple things...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 16
(2,219 Views)

You can change the ',' to '.' and also the decimal places by changing the string format.

 

Replace %#g with something from here: http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/format_specifier_syntax/

0 Kudos
Message 14 of 16
(2,215 Views)

Hello All,

My problem solved Smiley Happy Thanks to all of you especially Phil & GerdW for your precious time and help...

Regards

Attique Ur Rehman

0 Kudos
Message 15 of 16
(2,195 Views)

Dear GerdW

I already read the http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/format_specifier_syntax/ and change the string format from '%#g' to '%#12g' but I didn't observed any difference in the digits after the decimal point except the size of output .txt file gets larger with '%#12g' string format. Thats why I raised this query  on the forum Smiley Sad

Anyhow as mentioned earlier my problem solved via applying the following string format '%,;%#g' so once again many thanks to you and all others for helping.

Kind Regards

0 Kudos
Message 16 of 16
(2,187 Views)