LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loosing decimal values in string

Solved!
Go to solution

This might be a pretty simple question, but I is a simpleton with labview so be gentle.

 

I'm changing over a data collection vi from writing to a text file to writing to a csv. I have the write to csv file and files selections all set up and it is collecting data, and everything is under the headers they are supposed to be. The issue I am having is with my data strings. The only way I have found to get it to write is to convert everything to a string (including my array of SGL's and DBL's), because my first two columns are date and time, which are strings. But when it converts my remaining rows to strings, I only get the integer value I have no decimal point. I'm not really sure how to fix this any ideas?

 

Thanks

0 Kudos
Message 1 of 5
(3,919 Views)

Code?

0 Kudos
Message 2 of 5
(3,916 Views)
Solution
Accepted by topic author xxxsdxxx
your problem should be in conversion part how you convert to string
you have to use fractional number to string or if you use Array To Spreadsheet String Function
you have to use %F for format type
Message 3 of 5
(3,906 Views)

I'm sure you actually mean "losing" your values.  Unless you mean you want to tighten them up.

 

As Ben said, attach code.  There are several possibilites.  Are you using Write to Spreadsheet File to save the data, an Express VI, the File Write primitives, or something else to write to a file.  Perhaps the format code isn't seet properly.

 

The other possibillity.  Are you in a country that uses a comma for a decimal point instead of a real decimal point?  That can cause problems because by default, a comma will be interpreted as a delimited in a CSV ("comma separated value") file rather than a decimal point.  This could cause a problem at either the LabVIEW end or the Excel end depending on the combination of LabVIEW settings and system settings.  There are special format codes you use  %.; or %,; or %; depending on if you want LabVIEW to force the use of a decimal point, a comma, or just use the system setting.

0 Kudos
Message 4 of 5
(3,903 Views)

I changed my number-string conversion to fractional and it works fine now thanks! 

0 Kudos
Message 5 of 5
(3,895 Views)