# 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 Compatibility Considerations.

## Syntax

``pos = wait(h)``
``v = wait(he)``

## Description

example

````pos = wait(h)` blocks execution of the MATLAB® command line until you finish positioning the ROI object `h`. Indicate completion by double-clicking on the ROI object. The function returns the position, `pos`, of the ROI object.```

example

````v = wait(he)` blocks execution of the MATLAB command line until you finish positioning the ellipse ROI object `he`. Indicate completion by double-clicking on the ROI object. The function returns the coordinates of vertices, `v`, along the perimeter of the ellipse.```

## 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

collapse all

Ellipse ROI object, specified as an `imellipse` object.

## Output Arguments

collapse all

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 ObjectReturned 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 R2008a

expand all