Saving only difference in custom class matlab

会有一股神秘感。 提交于 2019-12-12 03:33:55

问题


I have defined a class Results that is supposed the hold the results of a certain operation. I perform this operation 10.000 times and add the result to the result class.

Since this operation is slow, to prevent data loss, I save the temporary results every time (that is, I call save('tempResults.mat', 'obj') inside a method in my class)

The issue is that I write from scratch the whole class every time. But by the 5000th time, the class is already ~ 1 Gb big. It is unusable to write 1 Gb of data 10.000 times, especially when only something small changes in in the class.

How do I solve this? Apparently the save function in matlab doesn't support this. I can also write a custom save function for my class (saving separately some matrix and vectors and then loading it again when it's time) but even for array or matrices the save function in matlab doesn't support appending new rows. So how to implement this?

来源:https://stackoverflow.com/questions/41573751/saving-only-difference-in-custom-class-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!