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: 

save or clear on button press

Solved!
Go to solution

My program collects a couple points of data on a button press using a state machine. The data are velocity measurements from multiple points along a track - I've got that part working (in the vi attached it's just random numbers so I can tinker with the code without plugging in the hardware).

Each measurement is appended to an array and added to a graph. Oon each button press the data exits the case structure and goes through a for loop with a shift register. Using this array, I am trying to implement two buttons: clear and save. Pressing clear would empty the array and the graph, while pressing save opens a dialog to save the numbers. It almost works! It saves fine, but to clear I have to press "clear" and then "measure" again.

I think my problem lies in how I'm attempting to reinitialize the main array, but after a lot of searching the forums I'm still stuck. I'm not sure if I'm almost there, or if a for loop is the wrong way to go and I need to get rid it altogether?

Thanks for any help!

Download All
0 Kudos
Message 1 of 6
(2,605 Views)
Solution
Accepted by topic author chet1

Fairly close.  You forgot that latching booleans need to be in the event case that reads them-  A chart works better than a graph and you never provided for a stop event.  The User interaction is enough to throttle the loop and the wait is not required.

Capture.PNG

No LAVA CCT here so a snippette would be unusable but I did attach the modified code (Saved to LabVIEW 2011)


"Should be" isn't "Is" -Jay
Message 2 of 6
(2,597 Views)

Thanks a ton!

0 Kudos
Message 3 of 6
(2,587 Views)

Actually it's still not quite there, sorry for being hasty. Now when I press save, only the most recent measurement is saved to disk. How can I make it so every data point showing on the waveform chart can be saved?

0 Kudos
Message 4 of 6
(2,582 Views)

Just get the chart history instead of using a local variable.  You do that with a property node.  Look in the Clear case, copy that property node, change it to a read and wire it up appropriately.


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
Message 5 of 6
(2,576 Views)

Or simply right-click the Local and Change to Property node


"Should be" isn't "Is" -Jay
Message 6 of 6
(2,559 Views)