problem with questdlg!!

8 ビュー (過去 30 日間)
Khaled Al-Faleh
Khaled Al-Faleh 2017 年 4 月 17 日
回答済み: TED MOSBY 2025 年 8 月 20 日 10:18
I want the code run infinite but Here work for two times then he gave me an error the error is ...
Operation terminated by user during movegui (line 157)
In questdlg (line 393)
movegui(QuestFig)
In Project_Test (line 25)
button = questdlg(promptMessage, titleBarCaption, 'Draw', 'Cancel', 'Draw');
here the code ..
I = imread('--'); %any image
imshow(I);
count=1;
while(1)
promptMessage = sprintf('Select area!');
titleBarCaption = 'Continue?!';
button = questdlg(promptMessage, titleBarCaption, 'Draw', 'Cancel', 'Draw');
if strcmpi(button, 'Cancel')
count=count-1;
break;
end
S1 = imrect;
count=count+1;
end

回答 (1 件)

TED MOSBY
TED MOSBY 2025 年 8 月 20 日 10:18
Hi,
You’re mixing two interactive things at the same time:
  • a modal dialog (questdlg) and
  • an interactive ROI tool (imrect).
The fix:
  1. Call questdlg.
  2. Handle “Cancel” or window close. If the user hits Cancel or closes the dialog, stop.
  3. After you start imrect, wait for the user to finish. Please note imrect is not recommended now, use drawrectangle. https://in.mathworks.com/help/images/ref/imrect.html
Hope it helps!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by