This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Create rectangularly bounded drag constraint function


fcn = makeConstrainToRectFcn(type, xlim, ylim)


fcn = makeConstrainToRectFcn(type, xlim, ylim) creates a position constraint function for draggable tools of a given type, where type is one of the following values: 'imellipse', 'imfreehand', 'imline', 'impoint', 'impoly', or 'imrect'. The rectangular boundaries of the position constraint function are described by the vectors xlim and ylim where xlim = [xmin xmax] and ylim = [ymin ymax].


Constrain drag of impoint within axes limits.

figure, plot(1:10);
h = impoint(gca,2,6);
api = iptgetapi(h);
fcn = makeConstrainToRectFcn('impoint',get(gca,'XLim'),...

Introduced in R2006a