MATLAB Programming/Entering data at the command line

Category:Book:MATLAB Programming#Entering%20data%20at%20the%20command%20line%20

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

 
 >>
Category:Book:MATLAB Programming#Entering%20data%20at%20the%20command%20line%20
Category:Book:MATLAB Programming