iptremovecallback
Delete function handle from callback list
Description
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, 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.
iptremovecallback(h,'WindowButtonMotionFcn',id2);
Input Arguments
obj
— Graphics object
figure | axes | uipanel | image
Graphics object, specified as a handle to a figure, axes, uipanel, or image graphics objects.
callback
— Callback property
character vector
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
ID
— Callback identifier
positive integer
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
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)