MATLAB Object-Oriented Programming

(Joyce) #1
The addition of the dynamic property causes the listener to execute its callback function,
DyPropEvtCb. The callback function assigns a value of true to the HiddenProp
property.

dt.HiddenProp

ans =

1

PropertyRemoved Event Callback Execution


Remove a dynamic property by calling delete on the meta.DynamicProperty object
that is returned by the addprop method. Removing the meta.DynamicProperty object
triggers the PropertyRemoved event.

Delete the meta.DynamicProperty object returned when adding the dynamic property
SpecialProp.

delete(ad)

The callback executes:

SpecialProp removed

The value of HiddenProp is now false.

dt.HiddenProp

ans =

0

How to Find meta.DynamicProperty Objects


You can obtain the meta.DynamicProperty object for a dynamic property using
findprop. Use findprop if you do not have the object returned by addprop.

ad = findprop(dt,'SpecialProp');

8 Properties — Storing Class Data

Free download pdf