Main Content

iptremovecallback

Delete function handle from callback list

Description

example

iptremovecallback(obj,callback,ID)deletes the callback with identifierIDfrom the list of callbacks for graphics objectobj.

Examples

Add and Remove Callbacks from Figure

Add three callbacks to a figure and try them interactively. Whenever MATLAB®detects mouse motion over the figure, functionsf1,f2, andf3are called in that order.

h = figure; f1 = @(varargin) disp('Callback 1'); f2 = @(varargin) disp('Callback 2'); f3 = @(varargin) disp('Callback 3'); id1 = iptaddcallback(h,'WindowButtonMotionFcn', f1); id2 = iptaddcallback(h,'WindowButtonMotionFcn', f2); id3 = iptaddcallback(h,'WindowButtonMotionFcn', f3);

Remove the callbackf2. Move the mouse over the figure again. Whenever MATLAB detects mouse motion over the figure, only functionsf1andf3are called.

iptremovecallback(h,'WindowButtonMotionFcn',id2);

Input Arguments

collapse all

Graphics object, specified as a handle to a figure, axes, uipanel, or image graphics objects.

Callback property of the graphics objectobj, specified as a character vector. For a list of callbacks for graphics objects, seeFigure Properties,Axes Properties,Panel Properties, andImage Properties.

Data Types:char

Callback identifier for functionfun, specified as a positive integer. This identifier is returned byiptaddcallbackwhen you add a function to the callback list.

Version History

Introduced before R2006a

See Also