Create dialog box to gather user input
creates a modal
dialog box containing one or more text edit fields and returns the values entered by
the user. The return values are elements of a cell array of character vectors. The
first element of the cell array corresponds to the response in the edit field at the
top of the dialog box. The second element corresponds to the next edit field
response, and so on. answer
= inputdlg(prompt
)
specifies
that the dialog box is resizeable in the horizontal direction when
answer
= inputdlg(prompt
,dlgtitle
,dims
,definput
,opts
)opts
is set to 'on'
. When
opts
is a structure, it specifies whether the dialog box is
resizeable in the horizontal direction, whether it is modal, and whether the
prompt
text is interpreted.
MATLAB program execution
continues even when a modal input dialog box is active. To block program
execution until the user responds, use the uiwait
function.
Users can enter scalar or vector values into Input dialog boxes. Use str2num
to convert space-delimited and comma-delimited values into row
vectors and to convert semicolon-delimited values into column vectors. For example, if
answer{1}
contains '1 2 3;4 -5 6+7i'
, the
conversion
produces:
input = str2num(answer{1}) input = 1.0000 2.0000 3.0000 4.0000 -5.0000 6.0000 + 7.0000i