LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to log a waveform (ex: sine wave) to excel

What I'm trying to do is log the Y value of a waveform with respect to time. For my test vi, I have a function generator generating a sine wave; after doing some comparison with it, I want to log the components of the sine wave into an excel file. Let's say, every 10ms or some amount of time, I want to log the amplitude of the sine wave into excel. At the end, by using the excel file, I would be able to use the data and graph the sine wave.

 

What I tried doing was use the elapsed time .vi hooked up to a case structure with 10ms. Inside the case, I'm using the 'Get Waveform Components' function where I log the Y component. So now, every 10ms, the amplitude of the sine wave gets logged. The PROBLEM here is that the Y component is always the dt=0 part of the sine wave, so I'm logging the same amplitude over and over. Not really sure what to do next now...

 

 

Thank you!

0 Kudos
Message 1 of 6
(3,396 Views)
I don't understand what you are doing. The Y value is an array. If you save the entire array and the dt, you can reproduce the signal. You can't necessarily do that when you save a single point at a time.
0 Kudos
Message 2 of 6
(3,372 Views)

In that case, how do I pull the values off of the array along with dt (time) onto a file such as excel for later use? 

0 Kudos
Message 3 of 6
(3,365 Views)
Write to Measurement File, Write to Spreadsheet File, etc.

Help> Find Examples.
0 Kudos
Message 4 of 6
(3,358 Views)

From my understanding, the sine wave from the FG has a dt of 1ms so if I were to write all this to a spreadsheet file, the file would be quite large. So my goal is to reduce the data in the file..

 

What if I only want to record the corresponding Y value of the sine wave at every dt=10ms (or any increments set by the user). Obviously by doing this, the reproduced sine wave at the end won't be as smooth but it will reduce the file size and the data.

 

Thank you for the help!

 

0 Kudos
Message 5 of 6
(3,354 Views)
Or it won't be a sine wave at all. The sine wave has a dt of whatever you set it to as well as the number of samples. It's the number of samples that is a concern, not the dt. As long as you pay attention to Nyquist, you can index out of the array however many samples you want.

You also have the option of saving the data as binary.
0 Kudos
Message 6 of 6
(3,350 Views)