Customize the process of saving and loading objects by implementing specific methods for your class. These methods can improve version compatibility, avoid initialization dependences, and restore functionality to loaded objects.
MATLAB® processes objects in the save and load operations so that loaded objects are in a known state.
Modify the save and load process to provide class version compatibility.
Use these basic programming patterns to implement custom save and load processes.
Specifying default values for properties in the class definition can reduce MAT-file size when saving multiple objects of the same class.
Using default values when adding properties to a class definition ensures that objects defined with previous versions have appropriate values when loaded.
It is more efficient to save data and recreated graphics than to save the whole graphics hierarchy in the MAT-file.
Avoid initialization order dependency by defining set methods for dependent properties.
Use hidden dependent properties to maintain class compatibility.
object modification in the constructor when you do not want to implement
Class can call the
defined by superclasses in the class hierarchy from their own
You can restore property listeners from the
save function does not save
dynamic property attributes. Use
to restore nondefault attributes values to dynamic properties.