LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save XY graph as binary file and read.

Hi, I need some assistance in saving xy graph as binary file and reading that file to get the same graph again.

Attached is the example where I generate random numbers in a xy graph, I need to save this data after running it for 100s and the reopen that file. Save as picture is not an option. Please advice.

0 Kudos
Message 1 of 8
(3,630 Views)

If its possible to time stamp the measurements so I can replay the events that would be awesome.

0 Kudos
Message 2 of 8
(3,627 Views)

Hi Sindrezg,

The good thing about writing to binary files is you can send it the data in any form you like. The only issue comes about when you want to read that information back, as the read function needs to know exactly how the data is structured to interpret the information.

 

For writing the graph data and then reading it back, I've modified the vi you attached to do this in a simple way. I should note that the method used to gather the graph data is not particularly good if you are expecting to run the application for a long period as it will hold the information in memory as it runs. However, for a short run this is not a big issue.

 

Nic

--------
Nico
Systems Engineer

Certified TestStand Architect Certified LabVIEW Architect

0 Kudos
Message 3 of 8
(3,555 Views)

Hi Nico, great, thanks. Do you have a better solution if I have more channels and will fill up the memory quite fast? Is it better to store as tdms or is it possible just to pick out/read the amplitude on each channel and enter this into an text file when the run is stopped?

 

S

0 Kudos
Message 4 of 8
(3,549 Views)

Hi,

It really depends on what information you really need to keep. If you have a large amount of data and you want to keep it all, it might be better to periodically save it to the file as it runs and close the file off appropriately. This would help with memory management.

 

The best way to approach that would be using a Producer/Consumer design pattern. This is described in brief here: http://www.ni.com/white-paper/3023/en/

 

Nic

--------
Nico
Systems Engineer

Certified TestStand Architect Certified LabVIEW Architect

0 Kudos
Message 5 of 8
(3,545 Views)

I didnt quite understand the white paper. I just basic want to save a xy graph other than a picture no matter how large the graph is. If possible just something that when measurements are stopped, reads value x1 and y amplitude, then x2 and y amplitude, x3 and amplitude etc, loads this into a excel, txt, binary or tdms file and saves it.

 

0 Kudos
Message 6 of 8
(3,527 Views)

Sorry, that white paper would help build an applicaiton that you intended to run for a longer period of time.

 

If you just wanted to export the values to excel you can invoke the method 'Export Data to Excel.' This would be the same as copying all the current data in the graph and pasting it in a spreadsheet.

 

Nic

--------
Nico
Systems Engineer

Certified TestStand Architect Certified LabVIEW Architect

0 Kudos
Message 7 of 8
(3,515 Views)

Attached is the finished program for write and read xy graph to binary file for those who need it:

 

 

0 Kudos
Message 8 of 8
(3,497 Views)