FUNCTION REFERENCE

input

Ask the user for a value or a line of text.

Ask the user for a value or a line of text.

Syntax

x = input(prompt)

Syntax

s = input(prompt, 's')

Shows prompt and waits for one line. Without 's' the line is evaluated as an expression in the current workspace: an empty line gives [], and an expression that fails prints the error and asks again. With 's' the line is returned as text, unevaluated. A \n in the prompt starts a new line. The CLI reads standard input; the desktop asks in the Command Window, and Stop cancels the wait.

Differences from MATLAB: The answer must be one expression, not a statement. Not available in the browser console; when the CLI's input has ended, input fails.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.