Saveobj and Loadobj for arrays of objects
Ältere Kommentare anzeigen
I am trying to customize the save() and load() process for a classdef. Cuurrently, I am using old-style saveobj() and loadobj() methods, as I am still trying to get familiar with the newer approach.
Unlike most class methods, calling saveobj and load obj on an array of objects,
saveobj(objArray)
loadobj(objArray)
does not result in the entirety of objArray being passed to the user-provided code. Instead, there is some background Matlab process that invokes them one element at a time, equivalent to,
for i=1:numel(objArray)
saveobj(objArray(i))
loadobj(objArray(i))
end
However, my saveobj() and loadobj needs to know things about the entire array being saved, and calling them one element at a time hides this information. Is there any way to overcome this problem? As I said, I am still getting acquainted with the newer custom serialization and deserialization tools. Is there any chance that could hold a solution?
2 Kommentare
Walter Roberson
am 21 Mai 2025
I wonder about saveobj({objArray}) ?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Object Save and Load finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!