Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

How to Use Properties

What Are Properties

Properties encapsulate the data that belongs to instances of classes. Data contained in properties can be public, protected, or private. This data can be a fixed set of constant values, or it can be dependent on other values and calculated only when queried. You control these aspects of property behaviors by setting property attributes and by defining property-specific access methods.

See Property Attributes for a summary of property attributes.

Flexibility of Object Properties

In some ways, properties are like fields of a struct object. However, storing data in an object property provides more flexibility. Properties can:

Types of Properties

There are two types of properties:

Features of Stored Properties

When to Use Stored Properties

Features of Dependent Properties

Dependent properties save memory because property values that depend on other values are calculated only when needed.

When to Use Dependent Properties

Define properties as dependent when you want to:

Controlling Property Access provides information on defining property access methods.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS