11-11-2013 03:19 PM - edited 11-11-2013 03:20 PM
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?
Thanks
11-11-2013 06:20 PM
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.
11-11-2013 11:16 PM - edited 11-11-2013 11:16 PM
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
11-12-2013 11:30 AM - edited 11-12-2013 11:30 AM
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.
11-12-2013 11:55 AM
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.
11-12-2013 12:44 PM
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 ?
11-12-2013 01:28 PM
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.
11-12-2013 03:06 PM
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
11-12-2013 03:29 PM
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.