This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

dynamicprops class

Superclass for classes that support dynamic properties


dynamicprops is an abstract class derived from the handle class. 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.


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







For information on class attributes, see Class Attributes.


expand all


Event NameTriggerEvent DataEvent Attributes
PropertyAddedWhen property is addedevent.DynamicPropertyEventNotifyAccess = private, ListenAccess = public
PropertyRemovedWhen property is removedevent.DynamicPropertyEventNotifyAccess = private, ListenAccess = public


Subclass dynamicprops

Derive a class from the dynamicprops class:

classdef InstanceProperty < dynamicprops

Add a property to an object of the class using the addprop method and assign a value to the property.

obj = InstanceProperty;
obj.NewProperty = 1:10
obj = 

  InstanceProperty with properties:

    NewProperty: [1 2 3 4 5 6 7 8 9 10]

Introduced in R2008a