how to give input in matlab code example

Example: input in matlab

x = input(prompt) 

displays the text in prompt and waits for the user to input a value and press
the Return key. The user can enter expressions, like pi/4 or rand(3), and
can use variables in the workspace.

If the user presses the Return key without entering anything, then input returns
an empty matrix.

If the user enters an invalid expression at the prompt, then MATLAB displays
the relevant error message, and then redisplays the prompt.

str = input(prompt,'s')
returns the entered text, without evaluating the input as an expression.

you can further read the documentation by executing the following command in the
command window

doc input

Tags:

Misc Example