why does "save -append" work so slow and increase the size of mat file for simple replacement?
14 views (last 30 days)
I am in this situation for couple of times but have no clue. I can understand that when there are structures in my data, saving may take long time due to decompression. However, what confused me is that, even when I replace the existing structures only, without creating any new elements, the updated mat file increased a lot. It looks like the old structures are not erased at all. Could anyone help me out here? Thanks a lot.
Benjamin Avants on 15 May 2014
If you use the -append option, save will not overwrite any of your existing data. It will simply add the new data into the existing file. This can/will duplicate variables and structures already stored in the file.
If you want to change some of the values and not others, you should open the file and load the existing data. Then change the values you want to change in the imported data before overwriting the old file with the modified data. This is faster than appending an existing file and you don't get duplicate entries.
If you have the full data set in memory that you wish to save, simply overwrite the existing file with the data in memory. This would be the fastest way if it is possible in your code.