dynamicprops.addprop - Add dynamic property - MATLAB (original) (raw)
Main Content
Class: dynamicprops
Syntax
Description
[P](#bu2k9r3-1-P) = addprop([A](#bu2k9r3-1-A),[PropertyName](#bu2k9r3-1-PropertyName))
adds a property named PropName
to each object in arrayA
. The output argument P
is an array ofmatlab.metadata.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
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
Output array returned as an array of matlab.metadata.DynamicProperty
objects. Use matlab.metadata.DynamicProperty
objects to define access methods for dynamic properties, to set property attributes, and to remove dynamic properties.
Examples
Add Dynamic Property
Add a dynamic property to an object of the Dyno
class.
classdef Dyno < dynamicprops properties Prop1 end end
Create an object
Add a property called DynoProp
p = addprop(o,'DynoProp');
Set the AbortSet
attribute of the dynamic property
Remove the dynamic property
Version History
Introduced in R2008a