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.


Class: dynamicprops

Add dynamic property


P = addprop(A,PropertyName)



P = addprop(A,PropertyName) adds a property named PropName to each object in array A. The output argument P is an array of meta.DynamicProperty objects that is the same size as A.

Dynamic properties exist only on the specific instance for which they are defined. Dynamic properties do not become part of the class definition.

You can add dynamic properties only to objects derived from the dynamicprops class. Access the data in dynamic properties using the instance variable and the property name (obj.PropertyName).

Input Arguments

expand all

Input array, specified as an object array of a class that is derived from dynamicprops.

Name of dynamic property, specified as a char vector.

Example: 'DynoProp'

Data Types: char | string

Output Arguments

expand all

Output array returned as an array of meta.DynamicProperty objects. Use meta.DynamicProperty objects to define access methods for dynamic properties, to set property attributes, and to remove dynamic properties.



To learn about attributes of methods, see Method Attributes.


Add Dynamic Property

Add a dynamic property to an object of the Dyno class.

classdef Dyno < dynamicprops

Create an object

o = Dyno;

Add a property called DynoProp

p = addprop(o,'DynoProp');

Set the AbortSet attribute of the dynamic property

p.AbortSet = 1;

Remove the dynamic property


Introduced in R2008a