MATLAB Object-Oriented Programming

(Joyce) #1

Save and Load Process for Objects


In this section...
“Save and Load Objects” on page 13-2
“What Information Is Saved?” on page 13-2
“How Is the Property Data Loaded?” on page 13-3
“Errors During Load” on page 13-3

Save and Load Objects


Use save and load to store and reload objects:

save filename object
load filename object

What Information Is Saved?


Saving objects in MAT-files saves:


  • The full name of the object class, including any package qualifiers

  • Values of dynamic properties

  • All property default values defined by the class at the time the first object of the class
    is saved to the MAT-file.

  • The names and values of all properties, with the following exceptions:

    • Properties are not saved if their current values are the same as the default values
      specified in the class definition.

    • Properties are not saved if their Transient, Constant, or Dependent attributes
      set to true.




For a description of property attributes, see “Specify Property Attributes” on page 8-7

To save graphics objects, see savefig.

NoteDo not use the pack command with objects that define events and listeners. The
pack command causes the destruction of any listeners defined for the objects in the

13 Saving and Loading Objects

Free download pdf