notify
Notifies listeners of a classdef event.
📝Syntax
notify(obj, eventName)
notify(obj, eventName, eventData)
📥Input Arguments
Parameter Description
obj a classdef handle object
eventName an event name as a string
eventData optional event data passed to listener callbacks
📄Description

notify runs listener callbacks registered for a classdef handle object event.

Callbacks receive the source object and the supplied event data.

💡Examples
Notify listeners of an event.
d = [tempdir(), 'nelson_help_notify/'];
mkdir(d);
filewrite([d, '/NelsonHelpNotifyCounter.m'], ["classdef NelsonHelpNotifyCounter < handle"; "  events"; "    CountChanged"; "  end"; "end"]);
addpath(d);
counter = NelsonHelpNotifyCounter();
lh = addlistener(counter, 'CountChanged', @(src, eventData) disp('changed'));
notify(counter, 'CountChanged');
delete(lh);
delete(counter)
🔗See Also
addlistenereventsclassdef
🕔Version History
Version Description
2.0.0 classdef event notification support added
Edit this page on GitHub