Salvataggio e caricamento degli oggetti
Ottimizzare il processo di salvataggio e di caricamento degli oggetti
Personalizzare il processo di salvataggio e caricamento degli oggetti, implementando metodi specifici per la classe. Questi metodi possono migliorare la compatibilità delle versioni, evitare le dipendenze da inizializzazione e ripristinare le funzionalità degli oggetti caricati.
Argomenti
Come eseguire il salvataggio e il caricamento con gli oggetti
- Save and Load Process for 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
Modify the save and load process to provide class version compatibility. - Basic saveobj and loadobj Pattern
Use these basic programming patterns to implement custom save and load processes.
Personalizzazione del salvataggio e del caricamento
- Reduce MAT-File Size for Saved Objects
Specifying default values for properties in the class definition can reduce MAT-file size when saving multiple objects of the same class. - Improve Version Compatibility with Default Values
Using default values when adding properties to a class definition ensures that objects defined with previous versions have appropriate values when loaded. - Save Object Data to Recreate Graphics Objects
It is more efficient to save data and recreated graphics than to save the whole graphics hierarchy in the MAT-file. - Avoid Property Initialization Order Dependency
Avoid initialization order dependency by defining set methods for dependent properties. - Maintain Class Compatibility
Use hidden dependent properties to maintain class compatibility. - Initialize Objects When Loading
EnablingConstructOnLoad
allows object modification in the constructor when you do not want to implement aloadobj
method. - Save and Load Objects from Class Hierarchies
Class can call theloadobj
andsaveobj
methods defined by superclasses in the class hierarchy from their ownloadobj
andsaveobj
methods. - Restore Listeners
You can restore property listeners from theloadobj
method.