Class defining listener objects
lh = event.listener(Hobj,'
event.listener class defines listener
objects. Listener objects respond to the specified event and identify
the callback function to invoke when the event is triggered.
lh = event.listener(Hobj,' creates
for the event named in
EventName, on the
Hobj is an array of object handles, the
listener responds to the named event on any of the objects referenced
in the array.
The listener callback function must accept at least two input arguments. For example,
function CallbackFunction(source,eventData) ... end
source is the object that is the source
of the event and
eventData is an
event.listener class is a
Generally, you create a listener object using
However, you can call the
directly to create a listener. When you use the
the listener's lifecycle is not tied to the object(s) being listened
to—once the listener object goes out of scope, the listener
no longer exists. See Control Listener Lifecycle for more information on creating
If you call
delete(lh) on the listener object,
the listener ceases to exist, which means the event no longer causes
the listener callback function to execute.
You can enable or disable a listener by setting the value of
Enabled property (see Properties
See Events for more information and examples of how to use events and listeners.
|Cell array of source objects|
|Name of the event|
|Function to execute when the event is triggered and the |
|The callback executes when the event occurs if and only if |