Properties contain object data. Classes define the same properties for all object, but each object can have unique data values. Property attributes control what functions or methods can access the property. You can define functions that execute whenever you set or query property values. Properties can trigger events when code accesses their values.
dynamicprops | Superclass for classes that support dynamic properties |
meta.DynamicProperty | Describe dynamic property of MATLAB object |
event.DynamicPropertyEvent | Event data for dynamic property events |
meta.property | Describe property of MATLAB class |
meta.Validation | Describes property validation |
meta.FixedDimension | Fixed dimension in property size specification |
meta.UnrestrictedDimension | Unrestricted dimension in property size specification |
meta.ArrayDimension | Size information for property validation |
matlab.lang.OnOffSwitchState | Represent on and off states with logical values |
There are different kinds of properties and each serves a different purpose.
When you define properties, you also specify property attributes that control certain aspects of the property’s behavior.
Attributes control the behavior of properties.
Specify a list of classes that can access a property.
Mutable and Immutable Properties
You can control what code can set property values.
Classes can assign default values to properties and you can change these values during object construction or direct access to the properties.
Define Class Properties with Constant Values
Use a class with Constant
properties to define constant values
Properties assigned objects as default values construct that object only once when the class is first loaded. Also, assignment to contained object properties behaves differently depending on whether the object is a handle or value.
You can restrict property values to a size and class, and apply functions to validate assigned values.
Property Class and Size Validation
Define class and size requirements for a property.
Property validation functions enable you to check the values being assigned to properties.
Metadata Interface to Property Validation
Programmatically determine the size, class, and validation functions that validate the values assigned to properties.
Property access methods execute code when property values are referenced or assigned. Implementing these methods enables you to control what actions occur when values are set or queried.
Property set methods must follow specific syntax and execution rules.
Property get methods must follow specific syntax and execution rules.
Set and Get Methods for Dependent Properties
Dependent properties need access methods because these properties do not store values. Property access methods manage interactions with the dependent properties.
Dynamic Properties — Adding Properties to an Instance
You can add instance data to an object derived from the dynamicprops
class.
Set and Get Methods for Dynamic Properties
You can implement what are effectively access methods for dynamic properties.
You can define listeners for PropertyAdded
and PropertyRemoved
events on dynamic properties.
Dynamic Properties and ConstructOnLoad
Use the ConstructOnLoad
attribute to save and load dynamic properties.