MATLAB Programming/Entering data at the command line


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:

 %test.m
 %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
 
 >>
Last modified on 2 March 2011, at 08:58