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.
- s (optional)
- Argument which indicates that a string input is being processed and additional quotes are not needed to qualify your response.
Outputs
- R
- The result of the evaluated input you entered.
Examples
R = input('Type the value of R here: ')
Type the value of R here: 3 * 6 + 4 * 7
R = 46
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.
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.