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

Description

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.

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

expand all

Events

Event NameTriggerEvent DataEvent Attributes
PropertyAddedWhen property is addedevent.DynamicPropertyEventNotifyAccess = private, ListenAccess = public
PropertyRemovedWhen property is removedevent.DynamicPropertyEventNotifyAccess = 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]

Introduced in R2008a