Main Content


Set vertex behavior of ROI object

setVerticesDraggable is not recommended. With the new Polygon ROI, set the value of the InteractionsAllowed property instead. For more information, see Compatibility Considerations.


setVerticesDraggable(h,TF) sets whether the vertices of the ROI object, h, can be dragged after placement.

Input Arguments

collapse all

ROI object, specified as an impoly object.

Polygon ROI vertices are draggable, specified as true or false.

Data Types: logical

Version History

Introduced in R2007b

collapse all

R2018b: setVerticesDraggable 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.

To specify whether the vertices of a polygon are draggable, assign a value to the InteractionsAllowed property of the Polygon ROI.

Update Code

Update all instances of setVerticesDraggable method.

Discouraged UsageRecommended Replacement

This example uses setVerticesDraggable to turn off the capability of moving the vertices of a polygon to reshape it.

h = impoly(gca,[188,30; 189,142; 93,141]);

Here is the equivalent code, creating a Polygon ROI and replacing use of setVerticesDraggable with setting the value of the InteractionsAllowed property to a value that doesn't provide reshaping abilities ('none').

h = drawpolygon(gca,'Position',[188,30; 189,142; 93,141]);
h.InteractionsAllowed = 'none';