08-05-2010 02:12 PM
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.
Solved! Go to Solution.
08-05-2010 02:29 PM
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?
08-05-2010 02:50 PM
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.
08-05-2010 02:55 PM
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.
08-05-2010 03:15 PM
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.
08-05-2010 03:26 PM
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.
08-05-2010 03:58 PM
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!!
08-05-2010 04:35 PM
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.
08-06-2010 10:27 AM
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.
08-06-2010 10:42 AM
When you finish the program? You mean after you click on the 'Quit' button?