questdlg

17 ビュー (過去 30 日間)
Kevin Gunawan
Kevin Gunawan 2011 年 12 月 21 日
Hi, I'm using questdlg command for asking whether to continue or stop the process. However I don't know how to specify the stop command
here is my code
selection = questdlg('1% Breakthrough has not reached','Continue?','Yes','No','Yes');
>>switch selection,
>>case 'Yes'
>>%let the program run, I leave it blank so it does nothing and continue to run
>>case 'No'
>>%how to stop the function ---> ?
>>end
FYI,I'm calling the function through GUI and the above code is not in the GUI m-files i.e. it's inside the function which is called from GUI. Thank you.

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 21 日
Generally speaking, you would
return
in the function. You might want to explicitly set some output variables before returning.
  1 件のコメント
Jan
Jan 2011 年 12 月 21 日
Inserting a "return" belongs to "Jedi tricks".

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

その他の回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 12 月 21 日
How is this function running? Does it just take a while? Is it in a while-loop? If it operated by a timer?
If it's operated by a timer this problem is very easy since you can just stop the timer. Else we have to know more about the function.

Image Analyst
Image Analyst 2011 年 12 月 24 日
Here's code snippet I often start with:
message = sprintf('Do you want to continue');
button = questdlg(message, 'Continue?', 'Yes', 'No', 'Yes');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(button, 'No')
return; % or break or continue, whatever you need.
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by