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 CodeUpdate 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 wait
function returns position information to the workspace in
the variable pos .
| To migrate use of the wait function,
create the ROI using the new ROI objects. Remove the
wait return value—the new
wait object function does not return
a value. Instead, the ROI updates the values properties
changed during the pause, such as the
Position
property. |
| The new wait object function does
not support a separate syntax for obtaining the position of
an Ellipse ROI. Use the wait(h) syntax
instead. |