How to pause the program?

2 ビュー (過去 30 日間)
bsd
bsd 2011 年 10 月 27 日
Hai,
While running the program, how to pause the program, and continue the program after pausing for a while? I need to pause the program while running, without giving any pause command in the program.
Looking for your reply.
BSD

回答 (3 件)

Andreas Goser
Andreas Goser 2011 年 10 月 27 日
I'd say it depends on the application. If you like to pause beacause of checking for a user input or if you like to sync soemthing to the clock. Let me know.

Jan
Jan 2011 年 10 月 27 日
Setting a debugger breakpoint might be helpful: Either by clicking in the bar on the left side of the editor, or by using dbstop. The keyboard command stops Matlab also and activates the command window until the command return is typed in.
These methods are described exhaustively in the documentation, see the "Gettind Started" chapters.

Daniel Shub
Daniel Shub 2011 年 10 月 27 日
It depends what you want to do while the program is paused. If you are simply trying to free up your computer to do something else or want to wait until something else happens that MATLAB cannot easily observe, then a pause button might work:
h(1) = uicontrol('String', 'Pause', 'Callback', 'uiwait', 'Units', 'Normalized', 'Position', [0, 0, 0.5, 1]);
h(2) = uicontrol('String', 'Resume', 'Callback', 'uiresume', 'Units', 'Normalized', 'Position', [0.5, 0, 0.5, 1]);
x = 0;
while true
x = x+1;
disp(num2str(x));
drawnow;
end

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by