| MATLAB Function Reference | ![]() |
Syntax
answer = inputdlg(prompt) answer = inputdlg(prompt,dlg_title) answer = inputdlg(prompt,dlg_title,num_lines) answer = inputdlg(prompt,dlg_title,num_lines,defAns) answer = inputdlg(prompt,dlg_title,num_lines,defAns,Resize)
Description
answer = inputdlg(prompt)
creates a modal dialog box and returns user inputs in the cell array. prompt is a cell array containing prompt strings.
answer = inputdlg(prompt,dlg_title)
dlg_title specifies a title for the dialog box.
answer = inputdlg(prompt,dlg_title,num_lines)
num_lines specifies the number of lines for each user entered value. num_lines can be a scalar, column vector, or matrix.
num_lines is a scalar, it applies to all prompts.
num_lines is a column vector, each element specifies the number of lines of input for a prompt.
num_lines is a matrix, it should be size m-by-2, where m is the number of prompts on the dialog box. Each row refers to a prompt. The first column specifies the number of lines of input for a prompt. The second column specifies the width of the field in characters.
answer = inputdlg(prompt,dlg_title,num_lines,defAns)
defAns specifies the default value to display for each prompt. defAns must contain the same number of elements as prompt and all elements must be strings.
answer = inputdlg(prompt,dlg_title,num_lines,defAns,Resize)
Resize specifies whether or not the dialog box can be resized. Permissible values are 'on' and 'off' where 'on' means that the dialog box can be resized and that the dialog box is not modal.
Example
Create a dialog box to input an integer and colormap name. Allow one line for each value.
prompt = {'Enter matrix size:','Enter colormap name:'}; dlg_title = 'Input for peaks function'; num_lines= 1; def = {'20','hsv'}; answer = inputdlg(prompt,dlg_title,num_lines,def);
![]()
See Also
dialog, errordlg, helpdlg, questdlg, warndlg
Predefined Dialog Boxes for related functions
| input | inputname | ![]() |