input

Displays a message, prompt, and interrupts script execution until you provide input.

Syntax

R = input(prompt)

R = input(prompt, 's')

Inputs

prompt
Message or prompt to be displayed.
Type: string
s (optional)
Argument which indicates that a string input is being processed and additional quotes are not needed to qualify your response.
Type: char

Outputs

R
The result of the evaluated input you entered.
Type: Any expression or data type.

Examples

Input an expression, which is evaluated:
R = input('Type the value of R here: ')
Type the value of R here: 3 * 6 + 4 * 7
R = 46
Input a string which is evaluated. You must add quotes:
R = input('What kind of an example is this? ')
What kind of an example is this? 'This is an example for the input command.'
R = This is an example for the input command.
Input a string, which is not evaluated. You do not need to add quotes:
R = input('How is the weather like today? ', 's')
How is the weather today? It is bright and sunny today!
R = It is bright and sunny today!

Comments

Your response may be a scalar, complex number, string, matrix, cell array, or any expression. An additional argument, 's', indicates that a string input is expected from you and quotes are not needed for your response.