|MATLAB Function Reference|
Input data using the mouse
enables you to select points from the figure using the mouse or arrow keys for cursor positioning. The figure must have focus before
ginput receives input.
[x,y] = ginput(n)
enables you to select
n points from the current axes and returns the x- and y-coordinates in the column vectors
y, respectively. You can press the Return key to terminate the input before entering
[x,y] = ginput
gathers an unlimited number of points until you press the Return key.
[x,y,button] = ginput(...)
returns the x-coordinates, the y-coordinates, and the button or key designation.
button is a vector of integers indicating which mouse buttons you pressed (1 for left, 2 for middle, 3 for right), or ASCII numbers indicating which keys on the keyboard you pressed.
If you select points from multiple axes, the results you get are relative to those axes coordinates systems.
Pick 10 two-dimensional points from the figure window.
Position the cursor with the mouse (or the arrow keys on terminals without a mouse, such as Tektronix emulators). Enter data points by pressing a mouse button or a key on the keyboard. To terminate input before entering 10 points, press the Return key.
Interactive Plotting for an example
Interactive User Input for related functions