Draw Shapes and Lines
When you specify the type of shape to draw, you must also specify its location on the image. The table shows the format for the points input for the different shapes.
Rectangle
Shape  PTS input  Drawn Shape 

Single Rectangle  Fourelement row vector [x y width
height] where


M Rectangles  Mby4 matrix $$\left[\begin{array}{cccc}{x}_{1}& {y}_{1}& widt{h}_{1}& heigh{t}_{1}\\ {x}_{2}& {y}_{2}& widt{h}_{2}& heigh{t}_{2}\\ \vdots & \vdots & \vdots & \vdots \\ {x}_{M}& {y}_{M}& widt{h}_{M}& heigh{t}_{M}\end{array}\right]$$ 

Line and Polyline
You can draw one or more lines, and one or more polylines. A polyline contains a series of connected line segments.
Shape  PTS input  Drawn Shape 

Single Line  Fourelement row vector [x_{1} y_{1} x_{2} y_{2}] where


M Lines  Mby4 matrix $$\left[\begin{array}{cccc}{x}_{11}& {y}_{11}& {x}_{12}& {y}_{12}\\ {x}_{21}& {y}_{21}& {x}_{22}& {y}_{22}\\ \vdots & \vdots & \vdots & \vdots \\ {x}_{M1}& {y}_{M1}& {x}_{M2}& {y}_{M2}\end{array}\right]$$ 

Single Polyline with (L1) Segments  Vector of size 2L, where L is
the number of vertices, with format, [x_{1},
y_{1}, x_{2}, y_{2},
..., x_{L}, y_{L}] .


M Polylines with (L1) Segments  2LbyN matrix $$\left[\begin{array}{ccccccc}{x}_{11}& {y}_{11}& {x}_{12}& {y}_{12}& \cdots & {x}_{1L}& {y}_{1L}\\ {x}_{21}& {y}_{21}& {x}_{22}& {y}_{22}& \cdots & {x}_{2L}& {y}_{2L}\\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ {x}_{M1}& {y}_{M1}& {x}_{M2}& {y}_{M2}& \cdots & {x}_{ML}& {y}_{ML}\end{array}\right]$$ where each row of the matrix corresponds to a different polyline and is of the same form as the vector for a single polyline. When you require one polyline to contain less than (L–1) number of segments, fill the matrix by repeating the coordinates of the last vertex. The block produces an error message if the number of rows is less than two or not a multiple of two. 

Polygon
You can draw one or more polygons.
Shape  PTS input  Drawn Shape 

Single Polygon with L line segments  Row vector of size 2L, where L is
the number of vertices, with format, [x_{1} y_{1} x_{2} y_{2} ...
x_{L} y_{L}] where
[x_{1} y_{1}] to [x_{L} y_{L}] to
complete the polygon. The block produces an error if the number of
rows is negative or not a multiple of two. 

M Polygons with the largest number of line segments in any line being L  Mby2L matrix $$\left[\begin{array}{ccccccc}{x}_{11}& {y}_{11}& {x}_{12}& {y}_{12}& \cdots & {x}_{1L}& {y}_{1L}\\ {x}_{21}& {y}_{21}& {x}_{22}& {y}_{22}& \cdots & {x}_{2L}& {y}_{2L}\\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ {x}_{M1}& {y}_{M1}& {x}_{M2}& {y}_{M2}& \cdots & {x}_{ML}& {y}_{ML}\end{array}\right]$$ where each row of the matrix corresponds to a different polygon and is of the same form as the vector for a single polygon. If some polygons are shorter than others, repeat the ending coordinates to fill the polygon matrix. The block produces an error message if the number of rows is less than two or is not a multiple of two. 

Circle
You can draw one or more circles.
Shape  PTS input  Drawn Shape 

Single Circle  Threeelement row vector[x y radius] where


M Circles  Mby3 matrix $$\left[\begin{array}{ccc}xct{r}_{1}& yct{r}_{1}& radiu{s}_{1}\\ xct{r}_{2}& yct{r}_{2}& radiu{s}_{2}\\ \vdots & \vdots & \vdots \\ xct{r}_{M}& yct{r}_{M}& radiu{s}_{M}\end{array}\right]$$ 

See Also
insertObjectAnnotation
 insertShape
 insertMarker
 insertText