Hi. I have a script that is really pushing the RAM limit of my computer and in one situation I have two large matrices of the same size that I want to combine (one plus the other) and then remove the original matrices. So this is the situation:
C=A+B;clear A B
But when I’m performing this calculation I’m already at 75% memory usage and during the operation it shoots up to 100% and really slows down the runtime of my calculation. So I was thinking that if instead of creating a third matrix I could overwrite one and then remove one like this;
A=A+B;clear BC=A;clear A
But it still increases the memory usage. Is there a way of combining two matrices without allocating more RAM than the two matrices requires separately? Or is this the way it has to be?
Best Answer