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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ox• For box definition, initialRect is [x y 0 0], where (x,y) is the figure’sCurrentPoint.• For box resizing, initialRect defines the rectangular region that you resize(e.g., a legend). fixedPoint is the corner diametrically opposite the trackingpoint.rbbox returns immediately if a button is not currently pressed. Therefore, youuse rbbox with waitforbuttonpress so that the mouse button is down whenrbbox is called. rbbox returns when you release the mouse button.ExamplesAssuming the current view is view(2), use the current axes’ CurrentPointproperty to determine the extent of the rectangle in dataspace units:k = waitforbuttonpress;point1 = get(gca,'CurrentPoint');finalRect = rbbox;point2 = get(gca,'CurrentPoint');point1 = point1(1,1:2);point2 = point2(1,1:2);p1 = min(point1,point2);offset = abs(point1-point2);% button down detected% return figure units% button up detected% extract x and y% calculate locations% and dimensionsx = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];hold onaxis manualplot(x,y)% redraw in dataspace unitsSee Alsoaxis, dragrect, waitforbuttonpress2-385

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

Saved successfully!

Ooh no, something went wrong!