Main Content


Delete function handle from callback list



iptremovecallback(obj,callback,ID) deletes the callback with identifier ID from the list of callbacks for graphics object obj.


collapse all

Add three callbacks to a figure and try them interactively. Whenever MATLAB® detects mouse motion over the figure, functions f1, f2, and f3 are 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 callback f2. Move the mouse over the figure again. Whenever MATLAB detects mouse motion over the figure, only functions f1 and f3 are called.


Input Arguments

collapse all

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

Callback property of the graphics object obj, specified as a character vector. For a list of callbacks for graphics objects, see Figure Properties, Axes Properties, Panel Properties, and Image Properties.

Data Types: char

Callback identifier for function fun, specified as a positive integer. This identifier is returned by iptaddcallback when you add a function to the callback list.

Version History

Introduced before R2006a