How do you code a toggle button to start/stop function that are plotting on a graph in a GUI?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am creating a GUI to teach simple projectile motion. I have two slider inputs for initial velocity and launch angle. With those two inputs, I have created a height vs. time graph within the GUI. I am interested in starting/stopping the function from plotting using a toggle button. I want the button to start out on stop, and for the user to push start to start the animated graph.
0 Commenti
Risposte (1)
Geoff Hayes
il 13 Apr 2017
Kam - if you want have a "process" running in the background (that you start by pressing the toggle button) then you may want to use a timer that will periodically perform an action. You could start it when you press the button, and stop the timer when you press the toggle again.
See https://www.mathworks.com/matlabcentral/answers/331892-matlab-timer-code-stop-button-to-clear-graph-and-bar-graph-whilst-having-real-time-data some of which can be used for your GUI. I think it all depends upon what your function is doing - presumably you pass or it reads the velocity and height and then draws the motion (in real-time?).
0 Commenti
Vedere anche
Categorie
Scopri di più su Animation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!