How do you code a toggle button to start/stop function that are plotting on a graph in a GUI?
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Geoff Hayes
2017 年 4 月 13 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!