フィルターのクリア

How to close a figure and make the rest of the code run?

6 ビュー (過去 30 日間)
Jose Andrés
Jose Andrés 2015 年 11 月 28 日
コメント済み: Image Analyst 2015 年 11 月 29 日
Hello everyone, I think I have an easy question but I don't know exactly how to execute it.
My code starts executing a GUI which opens a Figure where I have to visualize certain images. I want that when I finish my visualization and close this Figure (GUI), the rest of my code continues.
I think it should be something like:
GUI
while Figure isopen
%something
end
RestOfMyCode
or am I wrong?
Thank you so much for your help!

採用された回答

Walter Roberson
Walter Roberson 2015 年 11 月 28 日

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 11 月 28 日
Get the handle when you create the figure, then use a prompt to let the user know that s/he's ready to continue:
hFig = figure();
% Code to throw stuff up on the figure...
% Wait for user to say they're ready to continue:
promptMessage = sprintf('Do you want to Continue processing,\nor Quit processing?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
if strcmpi(buttonText, 'Quit')
return; % Bail out of program - call close(hFig) if you also want to close the figure, otherwise it leaves it up.
end
% Now continuing on with the program...
% Let's close the figure.
close(hFig);
  2 件のコメント
Jose Andrés
Jose Andrés 2015 年 11 月 29 日
I am sorry that I can't only accept one answer, because I used your help to make a selection in my code later, but the other answer was what I was looking for... :(
Thank you so much both of you!
Image Analyst
Image Analyst 2015 年 11 月 29 日
You (or anyone) can always "Vote" for answers to give additional reputation points. You can even vote for ones you chose as the answer. Anyway, glad I could help.

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

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by