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.


Delete function handle from callback list




iptremovecallback(h,callback,ID) deletes a callback from the list of callbacks created by imaddcallback for the object with handle h and the associated callback, specified by callback. ID is the identifier of the callback to be deleted. This ID is returned by iptaddcallback when you add the function handle to the callback list.


Register three callbacks and try them interactively.

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 one of the callbacks and then move the mouse over the figure again. Whenever MATLAB® detects mouse motion over the figure, function handles f1 and f3 are called in that order.

iptremovecallback(h, 'WindowButtonMotionFcn', id2);

Introduced before R2006a