This happens when saving a large (300 MB) structure. (It’s a containers.Map with strings as keys and various large matrices as values.)
Error message:
Out Of Memory during serialization of the Subsystem Data
Error using save
Error closing file C:\a\comsol\fibre_bundle_AP.mat.
Error in process_data3/saveData (line 132)
save(save_file, 'data');
As explained here, the
savefunction in current versions of Matlab makes a copy of the structure that it is saving. This may cause Matlab to run out of memory.One solution is to use an older version of
save, as follows:The above solves the problem for me.