MATLAB Programming/Entering data at the command line

< MATLAB Programming

The input() function lets your scripts process data entered at the command line. All input is converted into a numerical value or array. The argument for the input() function is the message or prompt you want it to display. Inputting strings require an additional 's' argument. Example:

 %let's ask a user for x
 x = input('Please enter a value for x:')

Then running the script would produce the output:

Please enter a value for x:3
 x = 3