MATLAB Answers


close a message box thru coding

Elysi Cochin さんによって質問されました 2012 年 11 月 8 日
how to close a message box displayed thru coding?... In my pjt to process an image it is taking time... so i displayed a message box saying "please wait'... now when the output is being displayed i wanted to close that message box automatically and then display the image.... what shud i do?

  0 件のコメント

サインイン to comment.

2 件の回答

Daniel Shub
回答者: Daniel Shub
2012 年 11 月 8 日

You could do something like
h = msgbox('please wait');
n = 0;
while rand > 1e-9; n = n+1; end;
Where the while loop is whatever processing that you want to do that takes a long time.

  1 件のコメント

Elysi Cochin 2012 年 11 月 8 日
thank u so much...

サインイン to comment.

Image Analyst
回答者: Image Analyst
2012 年 11 月 8 日

I'd suggest a method that is robust enough to handle if the user clicked the OK button on your message box without throwing an exception:
handleToMessageBox = msgbox('Please wait...');
% Do stuff that takes a long time.....
if exist('handleToMessageBox', 'var')
Otherwise if the user clicked the OK button, as users tend to do, then when it hits your delete() function, the handle is already gone and it will throw an error (I tried it). My way avoids that error by not trying to delete the handle if it doesn't exist anymore.

  2 件のコメント

Daniel Shub
2012 年 11 月 8 日
Even better might be waitbar
Elysi Cochin 2012 年 11 月 19 日
thanks all

サインイン to comment.

Translated by