questdlg
Displays a dialog box with a question s. By default, the dialog displayed will have the 'Yes', 'No' and 'Cancel' buttons.
Syntax
R = questdlg(s)
R = questdlg(s, c)
R = questdlg(s, c, defaultButton)
R = questdlg(s, c, button1, button2, defaultButton)
R = questdlg(s, c, button1, button2, button3, defaultButton)
Inputs
- s
- Content to display in the dialog. String inputs can have the '\n' newline character, which are displayed on separate lines of the dialog. String elements of cell inputs will be displayed on new lines in the dialog.
- c (optional)
- Specifies the caption to be displayed for the dialog. If no caption is specified, the caption displayed is 'Question'.
- defaultButton (optional)
- The default button that is applied when the 'Enter' key is pressed. defaultButton must match the text of other buttons in the dialog.
- button1 (optional)
- Specifies the text displayed for the first button in the dialog. The default text displayed is 'Yes'.
- button2 (optional)
- Specifies the text displayed for the second button in the dialog. The default text displayed is 'No'.
- button3 (optional)
- Specifies the text displayed for the third button in the dialog. If button3 is empty, the button is not displayed. The default text of the displayed button is 'Cancel'.
Outputs
- R
- R contains the text of the button you select.
Examples
R = questdlg({'Is', 'this', 'a', 'test?'}, 'Test')
R = Yes
Content displayed in the dialog with caption 'Test' is
'Is'
'this'
'a'
'test'
R = questdlg('Is this a test?', 'Test', 'No')
R = No
Content displayed in the dialog with the caption 'Test' is
'Is this a test?'
R = questdlg('How is the weather?', 'Weather', 'Sunny', 'Cloudy', 'Unpredictable', 'Unpredictable')
R = Unpredictable
Content displayed in the dialog with the caption 'Weather', with buttons 'Sunny',
'Cloudy' and 'Unpredictable' is 'How is the weather?'