LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to export data from waveform chart into excel automatically after stopping the execution?

In LabVIEW, after I run each simulation, I get data points on a waveform graph that I have on the front panel. To export the data, I have to physically do it after each run.

 

Therefore, is there a way to automatically export the data from the graph into excel once the stop button is pressed on the LabVIEW interface? 

 

Please help!!!

0 Kudos
Message 1 of 11
(3,010 Views)

Are you talking about a stop button connected to your toplevel while loop or the abort button in the toolbar? What is "physically do it"?

 

(Are you right-clicking the graph..export..to excel? In that case, you can create an invoke note for your graph with method "export data to excel" and call it as needed)

altenbach_1-1632378844519.png

LabVIEW has a rich set of file IO tools. What is the datatype of the graph? (1D array? 2D array? waveform? waveforms? dynamic? cluster of [x0, dx, Y]? etc.)

 

Typically you want a state machine where "save" is one of the states. Doing things after the main loop is not great. 

 

Do you have a simplified version of your VI that you can attach?

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

Thank you very much for your message. When I mean "physically do it", I mean that I have to right click on the waveform graph and need to click on the option to export it into excel. 

 

When I mean stop button, I mean the red stop botton in the tool bar. 

 

Kindly request your suggestions with regards to this and I will try to attach a VI as soon as possible. 

0 Kudos
Message 3 of 11
(2,980 Views)

The stop button in the toolbar will abort the VI and since the code is no longer running nothing can be done programmatically after pressing it.

 

The toolbar buttons are useful during code development. They have no purpose for a finished program. Think state machine instead (run when opened, go to idle state and wait for user interaction, close panel when completely done)

0 Kudos
Message 4 of 11
(2,974 Views)

With this message, I have attached screenshots of the LabVIEW VI File. 

 

In the VI file, there are two signals that are being generated and displayed on the waveform chart. However, in order to export the data into excel, I have to always right-click on the waveform chart in order to export the data to excel after I press the red stop button on the tool bar to stop the execution. 

 

Kindly request your valuable suggestions about if there is a way to ensure that the data from the waveform chart gets automatically exported into excel after the stop button in the tool bar is pressed?

 

Please help!!!

 

Block Diagram.PNGFront Panel.PNG

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

With the previous screenshots shown, the properties of the control simulation loop are shown in this post. Properties - 1.PNGProperties - 2.PNG

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

I am trying to export the data automatically by using the "Export Waveforms to Spreadsheet Vi", but I am stuck.

 

Kindly request your help!!!Trying to Export.PNG

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

If you have report generation toolkit you can use it to write to an excel file. 

 

Assuming that what you really need is the data saved so that you can choose to opening it using excel then the way that I always like because anything can read it is to save it as a tab delimited .txt file.  If you drag and drop such a file into excel it will open automatically. 

 

Also your sample program will only save the last two points.  You need to put a shift register in.  Initialize the shift register with an empty 2D array of numbers then below is an example of both ways of creating and saving the data using a do while loop.

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

@haroumou9 wrote:

 

Kindly request your valuable suggestions about if there is a way to ensure that the data from the waveform chart gets automatically exported into excel after the stop button in the tool bar is pressed?


The Stop sign on the toolbar is not a Stop button - it is an abort button. You have already been told that you cannot implement any code to automatically do anything after you press that button. You should implement code to do a proper shutdown. You already have this capability with the "Halt?" button. You can implement any code that needs to run on exit after your loop ends. As mentioned before a state machine is a good option. Also, why do you want to wait until after the loop completes to save your data? Most applications log the data during operation.

0 Kudos
Message 9 of 11
(2,905 Views)

@haroumou9 wrote:

In LabVIEW, after I run each simulation, I get data points on a waveform graph that I have on the front panel. To export the data, I have to physically do it after each run.

 

Therefore, is there a way to automatically export the data from the graph into excel once the stop button is pressed on the LabVIEW interface? 

 

Please help!!!


Short answer... No, not really 

 

A simple Tab delimited text file containing the X and Y values is all you need.

 

What I suggest is use an X/Y graph in your program and write the X and Y data to a file at the same time you are creating the graph.

 

(EDIT: I just noticed you only want the data exported, not the actual graph)

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 11
(2,896 Views)