Documentation Center

  • Trial Software
  • Product Updates

meta.DynamicProperty

meta.DynamicProperty class describes dynamic property of MATLAB object

Description

The meta.DynamicProperty class contains descriptive information about dynamic properties that you have added to an instance of a MATLAB® classes. The MATLAB class must be a subclass of dynamicprops. The properties of the meta.DynamicProperty class correspond to property attributes that you specify from within class definitions. Dynamic properties are not defined in classdef blocks, but you can set their attributes by setting the meta.DynamicProperty object properties.

You add a dynamic property to an object using the addprop method of the dynamicprops class. The addprop method returns a meta.DynamicProperty instance representing the new dynamic property. You can modify the properties of the meta.DynamicProperty object to set the attributes of the dynamic property or to add set and get access methods, which would be defined in the classdef for regular properties.

You cannot instantiate the meta.DynamicProperty class. You must use addprop to obtain a meta.DynamicProperty object.

To remove the dynamic property, call the delete handle class method on the meta.DynamicProperty object.

Obtain a meta.DynamicProperty object from the addprops method, which returns an array of meta.DynamicProperty objects, one for each dynamic property.

See Dynamic Properties — Adding Properties to an Instance for more information.

Properties

PropertyPurpose
Name

Name of the property.

Description

Currently not used

DetailedDescription

Currently not used

AbortSet

If true, and this property belongs to a handle class, then MATLAB does not set the property value if the new value is the same as the current value. This approach prevents the triggering of property PreSet and PostSet events.

Abstract attribute, default = falseIf true, the property has no implementation, but a concrete subclass must redefine this property without Abstract being set to true.
  • Abstract properties cannot define set or get access methods. See Property Access Methods

  • Abstract properties cannot define initial values. Assigning a Default Value

  • All subclasses must specify the same values as the superclass for the property SetAccess and GetAccess attributes.

  • Abstract=true should be used with the class attribute Sealed=false (the default).

Access

public – unrestricted access

protected – access from class or subclasses

private – access by class members only (not subclasses)

List of classes that have get and set access to this property. Specify classes as meta.class objects in the form:

  • A single meta.class object

  • A cell array of meta.class objects. An empty cell array, {}, is the same as private access.

Use Access to set both SetAccess and GetAccess to the same value. Query the values of SetAccess and GetAccess directly (not Access).

Constant attribute, default = false

Set to true if you want only one value for this property in all instances of the class.

  • Subclasses inherit constant properties, but cannot change them.

  • Constant properties cannot be Dependent

  • SetAccess is ignored.

See Properties with Constant Values

DefaultValue

Querying this property returns an error because dynamic properties cannot define default values.

DefiningClassThe meta.class object representing the class that defines this property.
GetAccess attribute, default = public

public – unrestricted access

protected – access from class or subclasses

private – access by class members only

SetAccess attribute, default = public

public – unrestricted access

protected – access from class or subclasses

private – access by class members only

Dependent attribute, default = false

If false, property value is stored in object. If true, property value is not stored in object and the set and get functions cannot access the property by indexing into the object using the property name.

See Property Get Methods

Transient attribute, default = false

If true, property value is not saved when object is saved to a file. See Understanding the Save and Load Process for more about saving objects.

Hidden attribute, default = falseDetermines whether the property should be shown in a property list (e.g., Property Inspector, call to properties, etc.).
GetObservable attribute, default = falseIf true, and it is a handle class property, then listeners can be created for access to this property. The listeners are called whenever property values are queried. See Property-Set and Query Events
SetObservable attribute, default = falseIf true, and it is a handle class property, then listeners can be created for access to this property. The listeners are called whenever property values are modified. See Property-Set and Query Events
GetMethodFunction handle of the get method associated with this property. Empty if there is no get method specified. See Get Method Syntax
SetMethodFunction handle of the set method associated with this property. Empty if there is no set method specified. See Property Set Methods
HasDefault

Always false. Dynamic properties cannot define default values.

Events

See Listen for Changes to Property Values for information on using property events.

Event NamePurpose
PreGetEvent occurs just before property is queried.
PostGetEvent occurs just after property has been queried
PreSetEvent occurs just before this property is modified
PostSetEvent occurs just after this property has been modified
ObjectBeingDestroyedInherited from handle

See Also

|

Was this topic helpful?