问题
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