what is the uiwait?

22 次查看(过去 30 天)
Pan
Pan 2012-8-18
what is the uiwait?
then, how to use it?
If you know, please tell me ,thank you!!
  1 个评论
Jan
Jan 2012-8-18
Did you read "help uiwait" and "doc uiwait" already?

请先登录,再进行评论。

采纳的回答

Matt Fig
Matt Fig 2012-8-18
编辑:Matt Fig 2012-8-18
uiwait(FIG_handle) blocks execution until either UIRESUME is called or the figure FIG is destroyed (closed). uiwait with no input arguments is the same as uiwait(gcf). In this example, a figure is created along with a pushbutton. After the figure is created, uiwait is called until you push the button. When you push the button, the callback calls uiresume.
f = figure('pos',[30 800 250 150]);
h = uicontrol('Position', [20 20 200 40], 'String', 'Continue', ...
'Callback', 'uiresume(gcbf);close(gcbf)');
disp('This will print immediately');
uiwait(gcf);
disp('This will print after you click Continue');
  2 个评论
Pan
Pan 2012-8-18
Hi,could I ask other question.
The uiwait could use in the button?
Jan
Jan 2012-11-22
Accpted.

请先登录,再进行评论。

更多回答(2 个)

Image Analyst
Image Analyst 2012-8-18
uiwait() will pause execution of your program until you do something, such as close or interact with some dialog box. For example if you do
msgbox('This will not stop. It will keep running code.');
Then it will pop up a message box and continue on with the subsequent code. It won't wait for the user to click the OK button. But if you wrap it in a uiwait(), it will wait for the user to click OK:
uiwait(warndlg('You have an anomalous situation here. Click OK to continue'));
uiwait(msgbox('I will wait for you to click OK.'));

Azzi Abdelmalek
Azzi Abdelmalek 2012-8-18
编辑:Azzi Abdelmalek 2012-8-18
%uiwait blocks the execution of the program until a current figure is closed
%example
t=0:0.1:2*pi;y=sin(t);
plot(t,y)
uiwait(gcf)%
%at this point the program will wait you close the curent figure and the continue
y=cos(t);
plot(t,y)
% for more details look at matlab help http://www.mathworks.com/help/techdoc/ref/uiwait.html
  2 个评论
Pan
Pan 2012-8-18
编辑:Pan 2012-8-18
Hi,could I ask other question.
The uiwait could use in the button?
Azzi Abdelmalek
Azzi Abdelmalek 2012-8-18
look at the example given by Matt Fig

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by