LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read and write a waveform

I have some questions when write/and waveform - I tested by write a few second of the data generated from the signal generator and read this information this

- How can I avoid the color different (aka the discountinuty in the waveform) because my intention is to have a single waveform not multiple waveforms.

- Assume that I do not know the length period x N of the test.data file, how do I know if the data has been complete read from the file. Or LabVIEW will read the whole file automatically?

 

Write.png11-11-2013 3-13-14 PM.png

Thanks

Download All
0 Kudos
Message 1 of 9
(4,175 Views)

Your WriteDataTest.vi writes a waveform consisting of 10 cycles of a sine wave to a file.  That works well but your ReadDataTest.vi then reads the entire waveform back 10 times with an offset of 1 record for each iteration.  The problem is that there is only one record so you end up reading the same waveform 10 times and get 10 plots on your chart, each a different color.  You have Auto Scale X turned off on the chart so you're only seeing the last 5 plots.

 

Get rid of the loop when you read the data back and you'll see the entire waveform only once.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 2 of 9
(4,155 Views)

Thanks. Here is strange thing (to me) that I use similar method, reading the signal from my generator vi, however, when I read the waveform, it is not connected to 1 waveform

0 Kudos
Message 3 of 9
(4,139 Views)

Your VI is generating 1 second of waveform data (8000 samples at 8000 samples per second).  That's what you're seeing on the graph and that's what's in the file you write.  If you want just one cycle of the waveform, which is the product of two frequencies, you'll need to adjust the number of samples and/or the sample rate.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 4 of 9
(4,112 Views)

I understand that I write 1s of 8000 sample each time I press the button, however, I set the append property of the Write Waveform = True. Assume that I press 1 2 3, then there should 3 seconds of sample in the file. 

The task I would like to accomplosh is actually, how can I read these 3 seconds as 1 single waveform.

0 Kudos
Message 5 of 9
(4,103 Views)

I use this code to read the waveform after it is created but problem is I have a multiple waveforms not a single waveform as I expect. I wonder if anyway I can receive just 1 waveform but with a long duration L = N*1 second? instead of getting N x 1 second waveforms ?

0 Kudos
Message 6 of 9
(4,095 Views)

Appending to a waveform file adds records to the file, it does not append to existing waveforms.  What you need to do is read the waveform in the file and apend to it then write back to the file without appending.  That will replace the file with a new one containing the waveform you created.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 7 of 9
(4,086 Views)

Could you provide an example how to append the records to single waveform. I have tried to different method but I cannot get them into single waveform

0 Kudos
Message 8 of 9
(4,081 Views)

This quick example does not append a record, it appends the data array of the second waveform onto the end of the first waveform to create one waveform.  This assumes the t0 and dt of both waveforms is the same and keeps the ones from the first waveform.  If dt is different you'll have to adjust for that.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 9 of 9
(4,077 Views)