LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appended text file in loop adds unwanted delimiter value at end of each iteration.

Solved!
Go to solution

I am using 'Export To Spreadsheet.vi' in a loop which saves a text file and appends data from a 1D array waveform for each iteration. My problem is that at the end of every iteration an extra delimiter value is appended to the file. When I then attempt to graph my data, I get gaps, as seen below (circled in black).

 

 

graph.png 

 

 

When I start to analyze the data, I'm sure this will be a nuisance. I can not seem to find a solution to this problem. Any advise would be greatly appreciated. 

 

Thanks.

0 Kudos
Message 1 of 8
(2,940 Views)

In LV2012, I only see "Export Waveforms To Spreadsheet File.vi". It works ok, here:

Example_VI.png

 

0 Kudos
Message 2 of 8
(2,932 Views)

I will post the section of the code that is giving me trouble. I am new to labview, so I am sure the way I coded this is probably not very efficient. Although, if you can point out any errors in my method, that would surely help.

 

Thanks.

 

 

0 Kudos
Message 3 of 8
(2,929 Views)

Export Waveforms... does indeed place an end of line at the end of the last line, resulting in a gap when the next batch of data is appended.  I just had the same problem with a VI that a co-worker had written.

 

The fix is non-trivial. First, make a copy of the Vi to a new location and with a modified name. (If you change a VI in vi.lib, it causes all kinds of problems.)

 

Then go in and place string indicators various places until you find where the extra EOL characters are. The output of Array to Spreadsheet String ends with EOL.  I do not have all the other changes readily accessible.  I think we also changed the time format because the default setting lost resolution.

 

That VI opens, writes, and closes the file on every call so this is not very efficient for frequent calls.

 

It would almost be easier to write a Waveform to String formatting VI which does what you want and then use the standard OpenCreate/Replace File, Write to Text File, and Close File functions.

 

Lynn

Message 4 of 8
(2,918 Views)
Solution
Accepted by Mike310

Just wire TRUE here 😄

 

Message 5 of 8
(2,915 Views)

@johnsold wrote:

Export Waveforms... does indeed place an end of line at the end of the last line, resulting in a gap when the next batch of data is appended.  I just had the same problem with a VI that a co-worker had written.



It didn't in the snippet I posted above (once I changed "write header" to false). Am I missing something?

0 Kudos
Message 6 of 8
(2,907 Views)

It appears that the multiple time columns does eliminate the blank lines.

 

It the application that my co-worker had, they wanted a single time column with multiple data columns. It adds blank lines after each iteration in that configuration.  Strange!

 

I may try to dig into that VI to see if there is some obvous reason for the difference.

 

Lynn

0 Kudos
Message 7 of 8
(2,877 Views)

Adding multiple time will do for now. Thanks TimeWaveZero.

 

Although, I may eventually be taking hours of data with four input waveforms and the file may become larger than necessary. Thus, I am going to look into what Johnsold advised and try to repair it so it may save without inserting the extra time columns.

 

Thanks everyone for the input. It was very helpful.

 

Mike 

0 Kudos
Message 8 of 8
(2,855 Views)