A callback is a function that executes in response to some predefined user action, such as clicking on a graphics object or closing a figure window. Associate a callback with a specific user action by assigning a function to the callback property for that user action.
All graphics objects have the following properties for which you can define callback functions:
Executes when you press the left mouse button while the cursor is
over the object or is within a few pixels of the object.
CreateFcn — Executes during
object creation after MATLAB® set all properties
DeleteFcn — Executes just
before MATLAB deletes the object
When you call a plotting function, such as
Figures have additional properties that execute callbacks with specific user actions:
KeyPressFcn — Executes when you
press a key while the cursor is in the figure window.
ResizeFcn — Executes when you
resize the figure window.
WindowButtonDownFcn — Executes
when you press a mouse button while the cursor is over the figure
background, a disabled user-interface control, or the axes background.
when you move the cursor in the figure window (but not over menus
or title bar).
WindowButtonUpFcn — Executes when
you release the mouse button, after having pressed the mouse button
in the figure.