MATLAB Object-Oriented Programming

(Joyce) #1

Reduce MAT-File Size for Saved Objects


In this section...
“Default Values” on page 13-5
“Dependent Properties” on page 13-5
“Transient Properties” on page 13-5
“Avoid Saving Unwanted Variables” on page 13-6

Default Values


If a property often has the same value, define a default value for that property. When the
user saves the object to a MAT-file, MATLAB does not save the value of a property if the
current value equals the default value. MATLAB saves the default value on a per class
basis to avoid saving the value for every object.

For more information on how MATLAB evaluates default value expressions, see “Property
Default Values” on page 8-18.

Dependent Properties


Use a dependent property when the property value must be calculated at run time. A
dependent property is not saved in the MAT-file when you save an object. Instances of the
class do not allocate memory to hold a value for a dependent property.

Dependent is a property attribute (see “Property Attributes” on page 8-9 for a complete
list.)

Transient Properties


MATLAB does not store the values of transient properties. Transient properties can store
data in the object temporarily as an intermediate computation step or for faster retrieval.
Use transient properties when you easily can reproduce the data at run time or when the
data represents intermediate state that can be discarded.

Reduce MAT-File Size for Saved Objects
Free download pdf