Create and display question dialog box
Syntax
button = questdlg('qstring')
button = questdlg('qstring','title')
button = questdlg('qstring','title','default')
button = questdlg('qstring','title','str1','str2','default')
button =
questdlg('qstring','title','str1','str2','str3','default')
Description
button = questdlg('qstring')
displays a modal dialog presenting the question 'qstring'. The dialog has three default buttons--No, Cancel, and Yes. 'qstring' is a cell array or a string that automatically wraps to fit within the dialog box. button contains the name of the button pressed.
button = questdlg('qstring','title')
displays a question dialog with 'title' displayed in the dialog's title bar.
button = questdlg('qstring','title','default')
specifies which push button is the default in the event that the Return key is pressed. 'default' must be 'Yes', 'No', or 'Cancel'.
button = questdlg('qstring','title','str1','str2','default')
creates a question dialog box with two push buttons labeled 'str1' and 'str2'. 'default' specifies the default button selection and must be 'str1' or 'str2'.
button =
questdlg('qstring','title','str1','str2','str3','default')
creates a question dialog box with three push buttons labeled 'str1', 'str2', and 'str3'. 'default' specifies the default button selection and must be 'str1', 'str2', or 'str3'.
Example
Create a question dialog asking the user whether to continue a hypothetical operation:
button = questdlg('Do you want to continue?',...
'Continue Operation','Yes','No','Help','No')
if strcmp(button,'Yes')
disp('Creating file')
elseif strcmp(button,'No')
disp('Canceled file operation')
elseif strcmp(button,'Help')
disp('Sorry, no help available')
end
See Also
dialog, errordlg, helpdlg, inputdlg, msgbox, warndlg
[ Previous | Help Desk | Next ]