LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save dynamic data to a spreadsheet with only two columns

Hi,
 
I have a problem with saving dynamic data to a spreadsheet file. I want to save voltage values every second for example. So I would like to have a spreadsheet file afterwards with two coulmns, one for the time values and one for the voltage values. Maybe you could have a look at my attached vi? In the way I did it I get a spreadsheet file with voltage values placed all over the screen and I don't get what the order is, but I don't know why.
 
I also tried it with the open file, write to file and close file vi's, but then I get files which I can't read afterwards??
 
Maybe you can help me. That would be great!
 
Thanks a lot!
0 Kudos
Message 1 of 16
(6,632 Views)
If you wire a TRUE to the transpose input of write to spreadsheet, you'll get a single column file. That will not solve your problem entirely since you lack the time column.
For that you'll need some programmation : get the t0 and deltaT values from your waveform data, then calculate all the time values, and concatenate  with the signal values before feeding the write to spreadsheet subvi.
 
Chilly Charly    (aka CC)
Message 2 of 16
(6,630 Views)

Hi CC,

 

thank you very much for your help. To transpose the matrix makes sense, thank you!!

But do you know how exactly to get the t0 and delt T from the waveform? Is there a special VI for it? And how do I exactly concatenate it, so that I get the correct value for the according time? Shall I merge the signals? Maybe you can add an example? That would be really great!

I'm sorry, this stuff is new for me...

 

THANKS!

Steffi

0 Kudos
Message 3 of 16
(6,613 Views)


steffi.kono a écrit: ... But do you know how exactly to get the t0 and delt T from the waveform? Is there a special VI for it? And how do I exactly concatenate it, so that I get the correct value for the according time? Shall I merge the signals? Maybe you can add an example? That would be really great!

Should be the "Get Wfm comp" function in the waveform subpalette. Get t0 and delta t, then calculate all the t values in a loop as t(i)= t0 + deltat * i. Use the Build array function  (in the array sub-palette) to associate the time and signal value.
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 16
(6,604 Views)

I hope this can work...

Message Edité par chilly charly le 11-02-2007 02:31 PM

Chilly Charly    (aka CC)
Download All
0 Kudos
Message 5 of 16
(6,592 Views)
Hi CC,

thank you very much, it helped a lot! Now I get the data the way I wanted to.

Maybe I can ask you another question:
Do you know how I can write a header to the spreadsheet file? If I use the "write to file"-vi, there is a boolean constant for the header. But I don't find it for the spreadsheet file.
I would like to have a header at the beginning of every test, means when I append data to an existing file, too.

THANK YOU!!
Steffi
0 Kudos
Message 6 of 16
(6,560 Views)
Outside the while loop, insert a write operation after the open/create file. Or replace it. Use the write character to file vi. It accepts a string as input. Use the tab separator to separate the columns, and return for the lines.
A nice operator is the Array to Spreadsheet string (in the string subpalette)
 
`


Message Edité par chilly charly le 11-05-2007 11:43 AM
Chilly Charly    (aka CC)
0 Kudos
Message 7 of 16
(6,555 Views)
Thanks a lot, CC!

Do you also know how to save the data with a "." instead of a ","? For example 3 Volts and 100mV: LabVIEW saves the value as 3,1V. I would like to have it as 3.1V.

Steffi
0 Kudos
Message 8 of 16
(6,527 Views)
Hi CC,

got another problem:

I would like to run the vi which you already know ; ) without saving data. But - while running the vi - I would like to have the option to save teh data. That's why I created a switch (on: save data, off: don't save data). I wanted to wire the switch to a case structure, but I don't know where to put the case structure and the "open/create file-vi". If I put both into the while loop (where I write the data to the spreadsheet file) then - of course - it asks me with every run of the loop where to save the data.
If I put the "open/create file-vi" outside the loop it asks me at the beginning of the application where to save the data, even though I maybe don't want to save data.

I don't know if it's understandable what I mean:
If I run then vi I would like to see the data without saving it first (e.g. on the waveform graph), then I maybe would like to save it, so I want to press a button to save the data. The vi should ask me where I want to save the data while still running. I would also like to stop saving data without stopping the run of the vi. Maybe I would like to save data to another file within the same run.
Do you know what I mean?

Thank you very much.
Kind regards,
Steffi
0 Kudos
Message 9 of 16
(6,525 Views)


steffi.kono a écrit: ... I would like to run the vi which you already know ; ) without saving data. But - while running the vi - I would like to have the option to save teh data. That's why I created a switch (on: save data, off: don't save data). I wanted to wire the switch to a case structure, but I don't know where to put the case structure and the "open/create file-vi". If I put both into the while loop (where I write the data to the spreadsheet file) then - of course - it asks me with every run of the loop where to save the data.
If I put the "open/create file-vi" outside the loop it asks me at the beginning of the application where to save the data, even though I maybe don't want to save data.

I don't know if it's understandable what I mean:
If I run then vi I would like to see the data without saving it first (e.g. on the waveform graph), then I maybe would like to save it, so I want to press a button to save the data. The vi should ask me where I want to save the data while still running. I would also like to stop saving data without stopping the run of the vi. Maybe I would like to save data to another file within the same run.
Do you know what I mean?

Not sure 😄
There are probably several ways to deal with this problem : I believe the simplest would be to use an uninitialized shift register to store the pathname. That way, on the first access only, the write.vi will ask for a file name.
There is also a "First call"function, that could be used to detect the first run, in the data communication>Synchronization subpalette.
 
I think the point/comma question can be solved at system level, by changing the numeric separator in Windows
Chilly Charly    (aka CC)
0 Kudos
Message 10 of 16
(6,514 Views)