| MATLAB® | ![]() |
[x,y] = ginput(n)
[x,y] = ginput
[x,y,button] = ginput(...)
ginput enables you to select points from the figure using the mouse 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 x and y, respectively. Press the Return key to terminate the input before entering n points.
[x,y] = ginput gathers an unlimited number of points until you press the Return key.
Note Clicking an axes makes that axes the current axes. Although you may set the current axes before calling ginput, whichever axes the user clicks becomes the current axes and ginput returns points relative to that axes. For example, if a user selects points from multiple axes, the results returned are relative to the different axes' coordinate systems. |
[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.
Pick 10 two-dimensional points from the figure window.
[x,y] = ginput(10)
Position the cursor with the mouse. 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
User Interface Development for related functions
![]() | GetWorkspaceData | global | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |