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
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)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
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). |
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 R2008aStarting 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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)