LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "write to spreadsheet" to save data when I want to?

Solved!
Go to solution

When I use write to spreadsheet to save data, I have to determine whether to save the data or not before running the program, is there a way that I can run the program and then decide whether to save the data, which means that I can have a "save" botton. After runing the program, when I push it, I can save the data, otherwise it is not. Thanks.

0 Kudos
Message 1 of 16
(3,437 Views)

Add your save button to the front panel. This can be simply wired to a case statement that is in your loop.

 

Have you tried anything? A case statement inside a loop is a pretty basic concept. Have you taken the tutorial?

0 Kudos
Message 2 of 16
(3,429 Views)

Hi Dennis, thank you for answering. I did not take any tutoring, while I know case structure inside a while loop but my problem is that this structure is in another Event case, ,and then they are in another case structure. So it does not work.

0 Kudos
Message 3 of 16
(3,420 Views)

Then you are going to have to post your code because I am having difficult time imagining your design.

 

If you have an event structure inside a while loop and the timeout event is doing the data capture, then you can pass the data to all other events with a shift register. If you have a while loop inside one of the events, that is a bad design but you can still place your case statement inside there as a quick hack.

0 Kudos
Message 4 of 16
(3,418 Views)

Hey Dennis,

 

Thanks so much for your patient. This is the code I downloaded for the website of Keithley. I can use it directly, the only thing I have to do is to add a save botton on the front pannel to save the data when I want to, but I am not sure where to put the "case in while loop" structure. Could you help me to add it? Thanks again.

0 Kudos
Message 5 of 16
(3,407 Views)

You would use the first option I described. Put a 'Save' button on the front panel. Right click on the event structure and select 'Add Event Case'. Select a Value Change event for the Save button. Put whatever file I/O function in this new event. Assuming you want the 2 1D arrays from the 'Start Sweep' event, wire these to a shift register on the outer while loop. You'll probably want to wire the data through all events and states and you'll want to initialize the data someplace.

0 Kudos
Message 6 of 16
(3,400 Views)

Hi Dennis,

 

i am sure you explained so clearly to me, but I am so frustrating that I still can not figure out. I have been working on this for the whole day and still got nothing. The problem is that the 2 1D data can not go through the event case, and I do not know how to initialize the data. I am so sorry to bother you for so long time. Could you please be kind to add the remaining stuff to me, I am so appreciete that you can help me with this problem which bothering me for a whole day. Thanks so much!!

0 Kudos
Message 7 of 16
(3,390 Views)

The data can easily go through the event case. Here's something to get you started.

 

Please take the time to go through that tutorial.

0 Kudos
Message 8 of 16
(3,382 Views)

Hi Dennis,

 

Thank you so much for your kind help. I am so sorry to bother you again. After I finish running the program, when pushing print botton, nothing happened. I was trying to figure out what is the problem this morning, but still got nothing, so I have no choice but bother you again. Sorry and thanks again.

0 Kudos
Message 9 of 16
(3,359 Views)

When you finish the program? You mean after you click on the 'Quit' button?

0 Kudos
Message 10 of 16
(3,353 Views)