From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving waveform to retrieve it back to display on waveform graph

I want to save a waveform that I acquire through my hardware and display it on a sweep chart. Its a time based voltage acquisition. I tried using write to spread sheet or save waveform options in LabVIEW 2009. But when I tried to read it, it only shows me 1 cycle of data(I will be suing a graph here because I want to add cursors to it). I want the exact same whole waveform to be displayed on a graph as I had acquired it. I want to avoid using express vi's since I will be acquiring 10 channels simultaneously so I dont want to slow down the execution speed.

I am attaching the base vi that i made to read and write the waveform to a file(I am using simulate signal in this attached vi just to simulate a square wave and check my logic functionality).

 

Can anyone help, please!

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 11
(2,688 Views)

You are creating a new file each time because you don't have a true constant wired to 'append to file' input.

0 Kudos
Message 2 of 11
(2,675 Views)

I tried wiring a true constant. But still when I use the read vi, it shows me one cycle of data. I want the exact representation of the signal that was simulated. I am attaching the screenshots. I want the read graph to be just like the write graph.

Download All
0 Kudos
Message 3 of 11
(2,672 Views)

First of all, the "Append" should only be True when i does not equal 0.

 

Secondly, you are only dealing with 1 signal, so have the dynamic data converter output a 1D array of scalers.  I then found that I had to transpose the spreadsheet on both sides (read and write).

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(2,667 Views)

Thank you crossrulz,

I implemented as per the image you sent. It partially worked. I mean lets suppose I generate a square wave of 1khz for 10 sec and then I stop the vi. Now when I read from file, I should be able to see the exact 1khz square wave spread over 10 sec which I want to be my x axis.

0 Kudos
Message 5 of 11
(2,654 Views)

Of course your x axis is not going to reflect any actual time. You've thrown away all of the timing information by converting to a dbl and using the Write to Spreadsheet File. The Write to Measurement File is not really much slower than the Write to Spreadsheet since they both produce text files and the file is opened and closed each time. If you want actual time on the x axis, you must write the dt to the file.

0 Kudos
Message 6 of 11
(2,652 Views)

yes that works, but I wanted to avoid it as I will be acquiring 10 channels simultaneously, so is there any other way to do it? perhaps using low level vi's?

0 Kudos
Message 7 of 11
(2,650 Views)

Of course. There are numerous options and the number of channels is not all that relevant. You can save as TDMS which is a binary format, for the fastest streaming. If you want efficiency, get rid of the DAQ Assistant and use the lower level DAQmx functions. There are examples that show how to do TDMS streaming.

 

If you want to keep text format, then you would have to format the data yourself and have the timing information in a header or in a different column. There is the function Write to Text File. You could open the file outside the loop and call this inside. Better than writing a text file inside the loop would be to use a producer/consumer architecture.

0 Kudos
Message 8 of 11
(2,647 Views)

I am not yet experienced in LabVIEW. But I tried using TDMS. Its working fine. But I am having problem configuring the X axis of the strip chart and waveform graph. I mean if I generate a signal for 1 min, the x axis on strip chart(write vi) as well as waveform graph(in read vi) should start from 0 and end at 1 min. But this does not appear to happen. I am attaching the vi's I made

Download All
0 Kudos
Message 9 of 11
(2,632 Views)

1)  You might want to turn the Autoscale X ON for the graph in the read function.

2)  You might want to set the Open TDMS File in the write to "create or replace".  This way you know you have fresh data.

3)  Wire up your error clusters and put an error indicator at the end.  These will often tell you what is wrong.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 11
(2,627 Views)