Why does the "matfile" function create files larger in size compared to the "save" function?

Comparing "matfile" and "save" with "-v7.3" shows different file sizes if the variables are objects (e.g. tabular classes, or Simulink objects like "Simulink.Signal").
If you save certain variables (object, e.g., tabular classes, or Simulink objects like "Simulink.Signal") with "save" (option "-v7.3"), the resulting file size is much smaller compared to using the "matfile" function to update existing variables in the MAT file.

 採用された回答

MathWorks Support Team
MathWorks Support Team 約9時間 前
編集済み: MathWorks Support Team 3分 前

0 投票

This is a known limitation when updating existing variables in a MAT-File: the MAT-File's size can increase, especially if the variable is an object. Using the "matfile" object to update variables is equivalent to using "save" with the "-append" flag. Therefore, you see the size increase using the "matfile" object and using "save" with "-append". 
The only workaround is to re-save to a new MAT-File, using "save" or "matfile" object (to a new MAT-File). This would create a whole new file, and the size would be, as one would expect.
This is also documented in this Bug Report.

その他の回答 (0 件)

製品

リリース

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by