LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert time as Y-value to saved files?

When I use the AI acquire waveform function, the waveform is 2 dimensional. But the saved file is only one dimensional, without the time scale. How can insert time value as Y axis in the saved file?
I tried to wire output of a clock and waveform data to an array. But they are not same type of terminal.
Is there a way to accomplish this? If possible, please show me an example.
Thanks!
0 Kudos
Message 1 of 7
(3,275 Views)
If you're not going to be doing any manipulation of the file outside of LabVIEW, then just use a "Write to Waveform File" vi which includes all the information for the waveform.   It's under Waveform->Waveform File I/O
Message 2 of 7
(3,270 Views)

I do want to modify the waveform outside of Labview. After all data has to be presented, even published.

0 Kudos
Message 3 of 7
(3,265 Views)
AI Acquire Waveform returns either a 1D array of SGLs or a waveform data type. It does not return a 2D array so what you're writing is what you're getting back. A graph will display an x axis but the values on the axis are determined by your offset and multiplier and not by any values in the 1D array. Do you want your columns to include relative time or absolute time? With relative time, the first value in the time column would be zero and each subsequent value is incremented by the sample rate of the data acquisition. It's simple to create an array of numbers with this. Then you can join the two arrays with the Build Array and use Write to Spreadsheet to save it. A header in the file could include the actual start time as a string. Use Write Characters to File to write the header before you write the data. To write absolute time and data, you have to convert the data to strings and then create a 2D array of strings. The simplest way to write a 2D array of strings, I think, is to modify the Write to Spreadsheet file per the instructions at the bottom of it's diagram.
0 Kudos
Message 4 of 7
(3,260 Views)

Thank you for your valuable response. Going to try this tomorrow.

When I tried to wire output of clock and waveform data to an array, it always tells me that they are not same type of output or terminal.

I want to use relative time as the x  value. (in the original post I mistyped it as Y, I couldn't find any way to change it). I hope it will work.

0 Kudos
Message 5 of 7
(3,252 Views)
Here is another problem I encountered (Labview 6.0)
I am using AI Waveform Scan to acquire waveform at sample rate 5000/second, 5000 samples. So every cycle 5000 data will be sent to the saved file. If I want to build an in crement array, what should I enclose inside the While Loop.
 
It will be nice if somebody can post a example.
 
0 Kudos
Message 6 of 7
(3,239 Views)
Something like this.
0 Kudos
Message 7 of 7
(3,234 Views)