addprop
Class: dynamicprops
Add dynamic property
Description
adds a property named P
= addprop(A
,PropertyName
)PropName
to each object in array
A
. The output argument P
is an array of
matlab.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
Output Arguments
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
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
delete(p)
Version History
Introduced in R2008a