Is it possible to add/combine matrices without increasing memory usage?
Ältere Kommentare anzeigen
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 B
C=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?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!