# ginput

## Purpose

Graphical input using the mouse in the graph window.

## Synopsis

    [x,y] = ginput(n)
    [x,y] = ginput
    [x,y,button] = ginput(...)

## Description

`ginput` provides the means of selecting points from the figure window using a mouse or arrow keys. Note that the window focus must be on the figure window for `ginput` to receive input.

`[x,y] = ginput(n)` gets `n` points from the current axes and returns the x- and y-coordinates in the column vectors `x` and `y`, respectively.

Use the mouse (or the arrow keys on some systems) to position the cursor. Enter data points by pressing a mouse button or a key on the keyboard. To terminate input before entering `n` points, press the Return key.

`[x,y] = ginput` gathers an unlimited number of points until the Return key is pressed.

`[x,y,button] = ginput(n)` and `[x,y,button] = ginput` return a third result, `button`, that contains a vector of integers specifying which mouse buttons were used (1, 2, 3 from left) or ASCII numbers if keys on the keyboard were used. If you do not specify an input argument, `ginput` gathers an unlimited number of points until you press the Return key.

## See Also

    gtext

(c) Copyright 1994 by The MathWorks, Inc.