meta.DynamicProperty class
Package: meta
Superclasses: meta.property
Describe dynamic property of MATLAB object
Description
The meta.DynamicProperty
class contains descriptive information about dynamic properties that have been added to an instance of a MATLAB® class. To add a dynamic property to a class instance, the class must be a subclass of the dynamicprops
class. The properties of the meta.DynamicProperty
class correspond to property attributes. Dynamic properties are not defined in classdef
blocks, but you can set their attributes by setting the meta.DynamicProperty
object properties.
Add a dynamic property to an object using the addprop
method of the dynamicprops
class. The addprop
method returns a meta.DynamicProperty
instance representing the new dynamic property. You can modify the properties of the meta.DynamicProperty
object to set the attributes of the dynamic property or to add set and get access methods, which, for regular properties, would be defined in the classdef
file.
To remove the dynamic property, call the delete
handle class method on the meta.DynamicProperty
object.
See Dynamic Properties — Adding Properties to an Instance for more information.
The meta.DynamicProperty
class is a handle
class.
Creation
You cannot instantiate the meta.DynamicProperty
class. The addprop
method returns a meta.DynamicProperty
when you add a dynamic property to an object. Use findprop
to get the meta.DynamicProperty
object for an object that already has a dynamic property.
Properties
Events
Event Name | Trigger | Event Data | Event Attributes |
---|---|---|---|
PreGet | Event occurs just before the property value is queried. | event.PropertyEvent |
|
PostGet | Event occurs just after the property value has been queried. | event.PropertyEvent |
|
PreSet | Event occurs just before the property value is changed. | event.PropertyEvent |
|
PostSet | Event occurs just after the property value has been changed. | event.PropertyEvent |
|
Examples
Return meta.DynamicProperty
Object
Use the dynamicprops
addprop
method to add a dynamic property to an object and return a meta.DynamicProperty
object. Make the property hidden by setting the Hidden
property of the meta.DynamicProperty
.
classdef MySimpleClass < dynamicprops end
obj = MySimpleClass;
mdp = addprop(obj,'InstanceProp');
mdp.Hidden = true;
Version History
Introduced in R2008a