Skip to main content

13.1) "input" And "ginput"


    • At times it may be desirable within a script or function for Matlab to ask for user input
    • For example, you may want to Matlab to ask you to enter a filename or to make a decision on how to proceed

Syntax: result=input(string);
[matlab]
>> result=input('Please enter filename:');
[/matlab]
result will contain what is entered, not including the closing
result will then be available to the rest of the script

    • Some times you may want to select single pixels from an image

Syntax: [x, y]=ginput(n)
Where n is the number of (x,y) points or mouse clicks.