how to stop in Gui

I am running a subroutine of controlling the movement of a stage from one place to another. I like to install a 'stop' button in GUI so I can stop the movement anytime I want.
Is there any way I can do it without breaking the subroutine, namely writing the steps of the subrountine into the program itself?

Answers (2)

Walter Roberson
Walter Roberson on 5 Oct 2011

0 votes

You would have to set a value somewhere that the subroutine periodically checked and exited if the value so indicated.

2 Comments

Feng
Feng on 5 Oct 2011
Thanks for asnser my question.
I guess that is my chanllenge. I am not sure how a stand alone subroutine, or a function I should say, can interact with a GUI action.
Thanks,
if (stop_button.value) %if button pushed
break;
end

Sign in to comment.

Sounds like you want to use a timer:
doc timer

2 Comments

Not sure how a timer would assist when it is a matter of a stop *button* ?
Stop button stops the timer.

Sign in to comment.

Categories

Find more on Just for fun in Help Center and File Exchange

Tags

Asked:

on 5 Oct 2011

Community Treasure Hunt

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

Start Hunting!