MATLAB Function Reference |
Syntax
Description
The response to the input
prompt can be any MATLAB expression, which is evaluated using the variables in the current workspace.
user_entry = input('
displays prompt
')
prompt
as a prompt on the screen, waits for input from the keyboard, and returns the value entered in user_entry
.
user_entry = input('
returns the entered string as a text variable rather than as a variable name or numerical value.prompt
', 's')
Remarks
If you press the Return key without entering anything, input
returns an empty matrix.
The text string for the prompt can contain one or more '\n'
characters. The '\n'
means to skip to the next line. This allows the prompt string to span several lines. To display just a backslash, use '\\'
.
If you enter an invalid expression at the prompt, MATLAB displays the relevant error message and then prompts you again to enter input.
Examples
Press Return to select a default value by detecting an empty matrix:
See Also
keyboard
, menu
, ginput
, uicontrol
inpolygon | inputdlg |
© 1994-2005 The MathWorks, Inc.