getpts

Specify points with mouse

getpts is not recommended. Use one of the ROI classes instead, described in ROI Creation Overview.

Syntax

[xi,yi] = getpts
[xi,yi] = getpts(fig)
[xi,yi] = getpts(ax)

Description

example

[xi,yi] = getpts lets you choose points in the current figure using the mouse. When you finish selecting points, getpts returns the coordinates of the selected points in xi and yi.

Use normal button clicks to add points. A shift-, right-, or double-click adds a final point and ends the selection. Pressing Return or Enter ends the selection without adding a final point. Pressing Backspace or Delete removes the previously selected point.

[xi,yi] = getpts(fig) lets you choose points in the current axes of figure fig, using the mouse.

[xi,yi] = getpts(ax) lets you choose points in axes ax, using the mouse.

Examples

collapse all

Display an image using imshow.

figure
imshow('moon.tif')

Call getpts to choose points interactively in the displayed image using the mouse. Double-click to complete your selection. When you are done, getpts returns the coordinates of your points.

[x,y] = getpts

Input Arguments

collapse all

Figure handle, specified as a handle.

Axes handle, specified as a handle.

Output Arguments

collapse all

x-coordinates of sampled points, returned as a numeric vector.

Data Types: double

y-coordinates of sampled points, returned as a numeric vector.

Data Types: double

Introduced before R2006a