23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

dragrect<br />

2dragrect<br />

Purpose Drag rectangles with mouse<br />

Syntax [finalrect] = dragrect(initialrect)<br />

[finalrect] = dragrect(initialrect,stepsize)<br />

Description [finalrect] = dragrect(initialrect) tracks one or more rectangles<br />

anywhere on the screen. The n-by-4 matrix, initialrect, defines the<br />

rectangles. Each row of initialrect must contain the initial rectangle<br />

position as [left bottom width height] values. dragrect returns the final<br />

position of the rectangles in finalrect.<br />

2-462<br />

[finalrect] = dragrect(initialrect,stepsize) moves the rectangles in<br />

increments of stepsize. The lower-left corner of the first rectangle is<br />

constrained to a grid of size equal to stepsize starting at the lower-left corner<br />

of the figure, and all other rectangles maintain their original offset from the<br />

first rectangle.<br />

[finalrect] = dragrect(...) returns the final positions of the rectangles<br />

when the mouse button is released. The default stepsize is 1.<br />

Remarks dragrect returns immediately if a mouse button is not currently pressed. Use<br />

dragrect in a ButtonDownFcn, or from the command line in conjunction with<br />

waitforbuttonpress to ensure that the mouse button is down when dragrect<br />

is called. dragrect returns when you release the mouse button.<br />

If the drag ends over a figure window, the positions of the rectangles are<br />

returned in that figure's coordinate system. If the drag ends over a part of the<br />

screen not contained within a figure window, the rectangles are returned in the<br />

coordinate system of the figure over which the drag began<br />

Example Drag a rectangle that is 50 pixels wide and 100 pixels in height.<br />

waitforbuttonpress<br />

point1 = get(gcf,'CurrentPoint') % button down detected<br />

rect = [point1(1,1) point1(1,2) 50 100]<br />

[r2] = dragrect(rect)<br />

See Also rbbox, waitforbuttonpress

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!