MATLAB: Append bug maybe.

appendsave function

In the .mat file, append the variable with the append command, which has the same name as the original variable in the file. Although it is overwritten, the file size is the sum of the two variables, which results in the file getting larger and larger. In fact, multiple variables in the file After saving from the workspace is very small. We think this is a bug and there is no real coverage. wonder if it is or not

Best Answer

  • This is by design. When you -append, then the .mat file as a whole is not rewritten: instead the place in the .mat file that stored the variable is marked as unused and the new information is put at the end of the file.
    If you were to later save a smaller version of the same variable, then the now-empty block in the file might be re-used, but this is not promised.
    -append makes no attempt to "compact" the file to remove the hole. It was designed for the situation where small update time was more important than smallest file.