dynamicprops Class
Superclass for classes that support dynamic properties
Description
dynamicprops
is an abstract class that supports dynamic properties.
Dynamic properties are used to attach temporary data to MATLAB® objects. Subclass dynamicprops
to define classes that
support dynamic properties.
Dynamic properties are associated with a specific object of the class, but are not part of the class definition. Use dynamic properties to attach temporary data to objects. For information on using dynamic properties, see Dynamic Properties — Adding Properties to an Instance.
Note
The isequal
function always returns
false
when comparing objects that have dynamic properties,
even if the properties have the same name and value. If you need to compare objects
that contain dynamic properties, overload isequal
as a method
of your class.
The dynamicprops
class is a handle
class.
Class Attributes
Abstract | true |
ConstructOnLoad | true |
HandleCompatible | true |
For information on class attributes, see Class Attributes.
Methods
Events
Event Name | Trigger | Event Data | Event Attributes |
---|---|---|---|
PropertyAdded | When property is added | event.DynamicPropertyEvent | NotifyAccess = private , ListenAccess =
public |
PropertyRemoved | When property is removed | event.DynamicPropertyEvent | NotifyAccess = private , ListenAccess =
public |
Examples
Subclass dynamicprops
Derive a class from the dynamicprops
class:
classdef InstanceProperty < dynamicprops end
Add a property to an object of the class using the addprop
method
and assign a value to the property.
obj = InstanceProperty;
obj.addprop('NewProperty');
obj.NewProperty = 1:10
obj = InstanceProperty with properties: NewProperty: [1 2 3 4 5 6 7 8 9 10]
Version History
Introduced in R2008a