Skip to Main Content Skip to Search
Product Documentation

makeConstrainToRectFcn - Create rectangularly bounded drag constraint function

Syntax

fcn = makeConstrainToRectFcn(type, xlim, ylim)

Description

fcn = makeConstrainToRectFcn(type, xlim, ylim) creates a position constraint function for draggable tools of a given type, where type is one of the following strings: '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].

Examples

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'),...
   get(gca,'YLim'));
api.setPositionConstraintFcn(fcn);

See Also

imdistline | imellipse | imfreehand | imline | impoint | impoly | imrect

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS