LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

export waveform to spreadsheet

Hi guys!
 
Right another problem for you all! (suprise suprise)
 
I am writing to an "export waveform to spreadsheet.vi" with some success.... However I have a couple of problems:
 
1) I am writing to it inside a while loop, it correctly puts in all the data for the first iteration, however on the second and subsequent iterations it creates the new file but doesn't put any data in it! Any ideas?
 
2) To speed things up in the data capture loop I am not immediately writing to a graph output, what I wanted to do is once all the data has been written to that file is to reopen it and plot this in a a graph so the user can tell if an event occured in the previous iteration! However the read "waveform from spreadsheet" doesn't seem to read the data?
 
I'm just off to negotiate rights to put the VI online (don't ask...) thought I would ask first to get people thinking!
 
Thanks
Jon 
 
 
0 Kudos
Message 1 of 24
(4,105 Views)
Et voila!
 
Any help would be great!

Thanks
Jon
0 Kudos
Message 2 of 24
(4,102 Views)

Hi Dave,

Right, I would reccomend writing the data using the Write Waveform VI rather than the export, as the export converts the data to a text string which cannot be read back by the read waveform. Simply replace the towo and change the append to file terminal as true on the write function.  With the read function, you can then either read one or all waveforms back by creating an indicator on the desired output terminal. I think that's why you aren's seeing any new data being recorded, the append was set to false in your program.

With the second part of your query, I am slightly confused as to why you are writing and reading within the loop. If you were to write in the loop, and once it's finished iterating, then read all the waveforms, that would make more sense. Writing and immediately reading back in each iteration doesn't seem logical to me. Maybe I am misunderstanding the goal of your app at this point.


Best wishes


Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 3 of 24
(4,068 Views)
Dave??
 
Thanks for that I'll give it a go in a minute! Regarding  the write/read I need a graph output for each iteration of the main loop, as each loop is an entire experiment on its own just at a different current!
 
It makes sense in my head but I'll have another think about it!
 
Thanks
Jon
0 Kudos
Message 4 of 24
(4,066 Views)

Jon,

Not sure what happened there, sorry about putting Dave!! Let me know how you get on. That's fine to write it out each time, but if you want to display the graph at the same time, just simply create an indicator on the waveform which will therefore neglect the need to read the data back in.

Best wishes
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 5 of 24
(4,063 Views)

Right, bad times I'm afraid!

I replaced the export waveform, to write waveform vi:

1) The resultant excel file was just full of unusable rubbish, no clear columns just masses of nonsense

2) The subsequent read file still didn't manage to display data to the graph

3) The second iteration file was again empty (as was the third and so on...)

 

Any more ideas? It's been driving me mad all week now!

Thanks

Jon

0 Kudos
Message 6 of 24
(4,060 Views)

Jon,

1. the file is saved a binary waveform format, so yes, it does look like gibberish if you open it in excel. To get round this, use the export waveform as you have done because this converts it into a text format, but then read it back in if required by using a Read text File VI, or read from Spreadhseet File VI instead.

2. Place the write function in the inner while loop, and then read it back in the outter loop. For each of the outter loop iterations, is the file path slightly different? I can't tell from you code?

3. | can't understand why they are empty, are you sure you have the append terminal set to true? See attached screenshot
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
Download All
0 Kudos
Message 7 of 24
(4,057 Views)

Right I've had a whole play around with the VI and have attached my current set up! Basically I followed your suggestions but brought the waveform chart inside the loop as its fast enough at the minute so all that write/read stuff is uneccesary!

I'm still not managing to write any data on the second iteration, I have attached a photo of a typical graph output with annotations to try and show whats happening! I am appending to current file but on the second/third iteration a new file name is input so I wondered  if this is affecting it? I don't see how as there are no "reset export to spreasheet...." to reset it?

 

Any ideas would be grand!

Thanks

Jon

0 Kudos
Message 8 of 24
(4,036 Views)

Right I've had a whole play around with the VI and have attached my current set up! Basically I followed your suggestions but brought the waveform chart inside the loop as its fast enough at the minute so all that write/read stuff is uneccesary!

I'm still not managing to write any data on the second iteration, I have attached a photo of a typical graph output with annotations to try and show whats happening! I am appending to current file but on the second/third iteration a new file name is input so I wondered  if this is affecting it? I don't see how as there are no "reset export to spreasheet...." to reset it?

 

Any ideas would be grand!

Thanks

Jon

0 Kudos
Message 9 of 24
(4,036 Views)

Right jon,

the problem with your program is not the fil IO, but it looks like you aren't acquiring data on the second and third iterations. If the waveform chart is not displaying this data, then this must be the problem area. The task you setup, is it for finite or continuous acquistion? Try placing a DAQmx Is task finished VI into the loop so that it releases the resource correctly (though I don't think this is the issue.

I think it would be better to have the task constant outisde of the main loop and to start the task only once. then simply have two nested while loops and only acquire when required. So take out the start and stop outside of the main while loop, and then read in the inner while loop when required. Let me know if this makes any difference to the data which is displayed on your plot.

Let me know how you get on, sorry for not getting back to you sooner.
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
Message 10 of 24
(3,996 Views)