- Listener callback functions must define at least two input arguments — the event
source object handle and the event data (See “Listener Callback Syntax” on page 11-
30 for more information). - Modify the data passed to each listener callback by subclassing the
event.EventData class.
Predefined Events
MATLAB Defines events for listening to property sets and queries. For more information,
see “Listen for Changes to Property Values” on page 11-40.
All handle objects define an event named ObjectBeingDestroyed. MATLAB triggers
this event before calling the class destructor.
Events and Listeners Syntax
Define an event name in the events code block:
classdef ClassName < handle
...
events
EventName
end
...
end
For example, MyClass defines an event named StateChange:
classdef MyClass < handle
events
StateChange
end
end
Trigger an event using the handle class notify method:
classdef ClassName < handle
...
events
EventName
end
...
methods