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?

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 10 月 5 日

0 投票

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

2 件のコメント

Feng
Feng 2011 年 10 月 5 日
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,
Sean de Wolski
Sean de Wolski 2011 年 10 月 5 日
if (stop_button.value) %if button pushed
break;
end

サインインしてコメントする。

Sean de Wolski
Sean de Wolski 2011 年 10 月 5 日

0 投票

Sounds like you want to use a timer:
doc timer

2 件のコメント

Walter Roberson
Walter Roberson 2011 年 10 月 5 日
Not sure how a timer would assist when it is a matter of a stop *button* ?
Sean de Wolski
Sean de Wolski 2011 年 10 月 5 日
Stop button stops the timer.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeJust for fun についてさらに検索

タグ

質問済み:

2011 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by