Event Attributes

Table of Event Attributes

The following table lists the attributes you can set for events. To specify a value for an attribute, assign the attribute value on the same line as the event key word. For example, all the events defined in the following events block have private ListenAccess and NotifyAccess attributes.

events (ListenAccess = 'private', NotifyAccess = 'private')
   anEvent
   anotherEvent
end

To define other events in the same class definition that have different attribute settings, create another events block.

Attribute Name

Class

Description

Hidden

logical Default = false

If true, event does not appear in list of events returned by events function (or other event listing functions or viewers).

ListenAccess

  • enumeration, default = public

  • meta.class object

  • cell array of meta.class objects

Determines where you can create listeners for the event.

  • public — Unrestricted access

  • protected — Access from methods in class or subclasses

  • private — Access by class methods only (not from subclasses)

  • List classes that have listen access to this event. Specify classes as meta.class objects in the form:

    • A single meta.class object

    • A cell array of meta.class objects. An empty cell array, {}, is the same as private access.

    See Controlling Access to Class Members

NotifyAccess
  • enumeration, default = public

  • meta.class object

  • cell array of meta.class objects

Determines where code can trigger the event

  • public — Any code can trigger event

  • protected — Can trigger event from methods in class or derived classes

  • private — Can trigger event by class methods only (not from derived classes)

  • List classes that have notify access to this event. Specify classes as meta.class objects in the form:

    • A single meta.class object

    • A cell array of meta.class objects. An empty cell array, {}, is the same as private access.

    See Controlling Access to Class Members

Was this topic helpful?