Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getrect

Specify rectangle with mouse

Syntax

rect = getrect
rect = getrect(fig)
rect = getrect(ax)

Description

rect = getrect lets you select a rectangle in the current axes using the mouse. Use the mouse to click and drag the desired rectangle. rect is a four-element vector with the form [xmin ymin width height]. To constrain the rectangle to be a square, use a shift- or right-click to begin the drag.

rect = getrect(fig) lets you select a rectangle in the current axes of figure fig using the mouse.

rect = getrect(ax) lets you select a rectangle in the axes specified by the handle ax.

Examples

collapse all

Display an image using imshow.

imshow('moon.tif')

Choose points interactively in the displayed image using the mouse. When you are done, getrect returns the size and position of your rectangle.

rect = getrect

See Also

|

Introduced before R2006a

Was this topic helpful?