GUI, stop the whole programme by pressing a push button,

1 view (last 30 days)
Hi everyone,
I'm designing a GUI which has got a push button called 'stop'. Also I have an axis which plots appear on it. My query is that when I press the push button, I want the graph to be cleared from the axis, which means stop running codes and finish the programme. I appreciate any help. Thank you.
Best,
S:-)

Answers (1)

Jan
Jan on 8 Sep 2011
Then check the value of the button from the running functions frequently and let them stop, when the toggle-button is pressed. In addition insert a command to clear the axes in the callback of the button.
If you need a more explicit answer, edit your question (do not add a comment...) and insert what you have done so far and where which problems occurred.
  3 Comments
Walter Roberson
Walter Roberson on 8 Sep 2011
Toggle buttons are uicontrol, and they *do* have a Value property. Their Value is the same as their Min property when the button is "off", and it is the same as their Max property when the button is "on". If you use the default values, that means the Value would be 0 when the button is out and 1 when the button is in.
Jan
Jan on 8 Sep 2011
A button does have a property called 'Value': ButtonH=uicontrol('Style', 'ToggleButton'); get(ButtonH, 'Value');
You have to stop the function, which draws in the axes before calling CLA. But I cannot give a specific advice, because you do not post the relevant code.

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!