08-07-2013 04:11 PM
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).
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.
Solved! Go to Solution.
08-07-2013 04:34 PM
In LV2012, I only see "Export Waveforms To Spreadsheet File.vi". It works ok, here:
08-07-2013 04:49 PM
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.
08-07-2013 05:21 PM
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
08-07-2013 05:30 PM
Just wire TRUE here 😄
08-07-2013 05:38 PM
@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?
08-07-2013 07:37 PM
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
08-07-2013 08:55 PM
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