Add function handle to callback list
Add Two Callback Functions to Figure
Create a figure and register two callback functions. Whenever
MATLAB® detects mouse motion over the figure, function handles
f2 are called
in the order in which they were added to the list.
figobj = figure; f1 = @(varargin) disp('Callback 1'); f2 = @(varargin) disp('Callback 2'); iptaddcallback(figobj,'WindowButtonMotionFcn',f1); iptaddcallback(figobj,'WindowButtonMotionFcn',f2);
obj — Graphics object
figure | axes | uipanel | image
Graphics object, specified as a handle to a figure, axes, uipanel, or image graphics objects.
Callback functions that have already been added to an object using the
setcommand continue to work after you call
iptaddcallback. The first time you call
iptaddcallbackfor a given object and callback, the function checks to see if a different callback function is already installed. If a callback is already installed, then
iptaddcallbackreplaces that callback function with the
iptaddcallbackcallback processor, and then adds the preexisting callback function to the