I want to automatically convert class objects to structs before saving them to MAT files.
This webpage seems to explain the task that I expect. However, when I try the following, it trurn out that it is not as expected:
mySuper = MySuper;
The saved file contains mySuper variable still as a class object, not a struct.
If I delete the class and load the file afterwards, I get:
Warning: Variable 'mySuper' originally saved as a MySuper cannot be instantiated as an object and will be read in as a uint32.
> In uiimport/runImportdata (line 459)
In uiimport/gatherFilePreviewData (line 438)
In uiimport (line 262)
Class MySuper could be extended by changing the saveobj method to the following:
function S = saveobj(obj)
S = struct(obj);
But this doesn't work either.
I'm using MATLAB R2020a.