12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

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.

dragrectPurpose2dragrectDrag rectangles with mouseSyntaxDescription[finalrect] = dragrect(initialrect)[finalrect] = dragrect(initialrect,stepsize)[finalrect] = dragrect(initialrect) tracks one or more rectanglesanywhere on the screen. The n-by-4 matrix, rect, defines the rectangles. Eachrow of rect must contain the initial rectangle position as[left bottom width height] values. dragrect returns the final position of therectangles in finalrect.[finalrect] = dragrect(initialrect,stepsize) moves the rectangles inincrements of stepsize. The lower-left corner of the first rectangle isconstrained to a grid of size stepsize starting at the lower-left corner of thefigure, and all other rectangles maintain their original offset from the firstrectangle. [finalrect] = dragrect(...) returns the final positions of therectangles when the mouse button is released. The default stepsize is 1.RemarksExampledragrect returns immediately if a mouse button is not currently pressed. Usedragrect in a ButtonDownFcn, or from the command line in conjunction withwaitforbuttonpress to ensure that the mouse button is down when dragrectis called. dragrect returns when you release the mouse button.Drag a rectangle that is 50 pixels wide and 100 pixels in height.waitforbuttonpresspoint1 = get(gcf,'CurrentPoint') % button down detectedrect = [point1(1,1) point1(1,2) 50 100][r2] = dragrect(rect)See Alsorbbox, waitforbuttonpress2-127

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

Saved successfully!

Ooh no, something went wrong!