Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

meta.DynamicProperty

Describe 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.

The dynamicprops addprop method returns an array of meta.DynamicProperty objects, one for each dynamic property added.

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, 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

Setting the Constant attribute of a dynamic property is not allowed. Dynamic properties cannot be constant.

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 Save and Load Process for Objects 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.).

NonCopyable

default = false

Determines if dynamic property should be copied when object is copied. By default, dynamic properties are not copied.

For more information, see Exclude Properties from Copy

GetObservable attribute, default = falseIf true, 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, 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?