Saving memory by reusing a variable name?

조회 수: 7 (최근 30일)
Uri Shalit
Uri Shalit 2011년 2월 22일
I have a code that uses pretty large files which causes some memory problems.
In my code I have a very large sparse matrix X, which I then multiply by a small dense matrix A. My question is, does the code:
Y=AX; clear X;
use less space when compared with:
X=AX;
  댓글 수: 1
Oliver Woodford
Oliver Woodford 2011년 2월 22일
I think you mean A*X (in MATLAB syntax).

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt Tearle
Matt Tearle 2011년 2월 22일
I'd guess they'd be the same. Matrix multiply requires having to make an intermediate variable anyway (behind the scenes, if not explicitly).

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by