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

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)

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

Thanks Jan for your answer, but the button does not have value, which property of the button you exactly mean? I have the code 'cla(gca)' to clear the axis in the callback, which is working, but after it passes this point it goes to the programme and start to plot the rest of the data. but I want the plot stop right here. is there a code like ctrl-c or something that I can put after 'cla(gca)' in the callback? appreciate your help.
S:-)
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.
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

Asked:

S
S
on 8 Sep 2011

Community Treasure Hunt

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

Start Hunting!