LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to text file formatting questions

Solved!
Go to solution

Apologies if I am touching on a subject discussed elsewhere.  I have two issues, which I believe to be related, that I am having difficulty overcoming.  I am collecting voltage date, converting it to a temperature, and then writing the time stamp, temperature, excitation voltage, and original voltage to file.  Currently, when I write these values to file the date and time appear on one line, the temperature and voltages appear on the following line, and then there is a space before the pattern repeats.  Furthermore, before data is collected I write information to a header, and if you look at the attached .csv file, you'll see that the data is all offset one column to the left.  Any ideas how I can solve this problem?  My code probably speaks for itself, but I am very much a novice so any general insight in non-jargon terminology will be humbly accepted.  Cheers, Peter.

Download All
0 Kudos
Message 1 of 4
(2,516 Views)
Solution
Accepted by topic author Geologian

Geo,

 

Don't build your strings into an array of strings.  An array of strings are written one/line in the "Write Text To File" function.

 

Use the Concatenate Strings function and catenate a tab between the date/time and the first value.  The "write Text to File function will add its own EOL string at the end of the write.

LabVIEW ChampionLabVIEW Channel Wires

Message 2 of 4
(2,505 Views)

Your problem is where you are building your data line.  Why are you using Build Array and then Inster into Array?  You don't want arrays when writing to the text file.  Each element of an array will be a different line.  What you really want is Concatinate String.  Use the Concatinate String to build a string with your timestamp, a comma, and your "spreadsheet string" that contains your data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(2,504 Views)

Thanks to both of you. In hindsight I don't know how I didn't see that.

Cheers,

Peter

0 Kudos
Message 4 of 4
(2,494 Views)