wait
(Not recommended) Block MATLAB command line until ROI creation is finished
wait
is not recommended. Use the wait
method associated with the new ROIs instead. For more information, see Version History.
Description
Examples
Click and Drag to Place Rectangle
Interactively place a rectangle by clicking and dragging. Use
wait
to block the MATLAB command line. Double-click on the rectangle to resume
execution of the MATLAB command line.
imshow("pout.tif")
h = imrect;
position = wait(h)
Click and Drag to Place Ellipse
Interactively place an ellipse by clicking and dragging. Use
wait
to block the MATLAB command line. Double-click on the ellipse to resume execution
of the MATLAB command line.
imshow("coins.png")
h = imellipse;
position = wait(h)
Input Arguments
Output Arguments
pos
— Position of ROI object
numeric array
Position of the ROI object, returned as a numeric array. The shape of the
array depends on the type of ROI object, and is consistent with the output
of getPosition
.
ROI Object | Returned position |
---|---|
imfreehand | n-by-2 matrix. The two columns define the x- and y-coordinates, respectively, of the n points along the boundary of the freehand region. |
imline | 2-by-2 matrix of the form [x1 y1; x2
y2] , representing the position of the two
endpoints of the line. |
impoint | 1-by-2 vector of the form [x
y] . |
impoly | n-by-2 matrix. The two columns define the x- and y-coordinates, respectively, of each of the n vertices. |
imrect | 4-element vector of the form [xmin ymin width
height] . The initial size of the rectangle is
width -by-height
pixels. The upper-left corner of the rectangle is at the
(x,y) coordinate
(xmin ,ymin ). |
v
— Vertices of ellipse ROI object
n-by-2 matrix
Vertices of ellipse ROI object, returned as an n-by-2
matrix. The two columns define the x- and
y-coordinates, respectively, of each of the
n vertices. The form of the matrix is consistent with
the output of getVertices
.
Version History
Introduced in R2008aR2018b: wait
is not recommended
Starting in R2018b, a new set of ROI objects replaces the existing set of ROI objects. The new objects provide more functional capabilities, such as face color transparency. The new classes also support events that you can use to respond to changes in your ROI such as moving or being clicked. Although there are no plans to remove the old ROI objects at this time, switch to the new ROIs to take advantage of the additional capabilities and flexibility. For more information on creating ROIs using the new ROI functions, see Create ROI Shapes.
In 19b, all the new ROI objects support a wait
object function,
as the old ROI objects did. Use the wait
function to block the
MATLAB command line after creating an ROI. For example, you can use
wait
to block the command line until you have finished
positioning the ROI.
By default, the new wait
function returns control to the
command line after you double-click the ROI. However, using events, you can
implement a custom wait
function that resumes execution of the
command line after several types of actions, such as clicking the ROI while pressing
the Shift key or clicking a specific part of the ROI such as the label. For an
example, see Use Wait Function After Drawing ROI.
Update all instances of wait
.
Discouraged Usage | Recommended Replacement |
---|---|
This example creates a Rectangle ROI and then pauses
the MATLAB command line. You can move the ROI during this
pause. When you are done, double-click the mouse. Control
returns to the command line and the imshow('cameraman.tif') h = imrect(gca,[10 10 100 100]); pos = wait(h); % When you double-click, wait returns. % View the value of the pos variable. pos | To migrate use of the imshow('cameraman.tif'); h = drawrectangle(gca,'Position',[10 10 100 100]); wait(h); % When you double-click, control returns to the command line. % View the value of the Position property. h.Position |
he = drawellipse; pos = wait(he); | The new |
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)