Does 'zeros' overwrite existing memory or alocate new memory and replace adress?

1 回表示 (過去 30 日間)
Daniel
Daniel 2014 年 1 月 7 日
コメント済み: Daniel 2014 年 1 月 7 日
I have a matrix inside a handle class, that needs to be reset to zero from time to time. Does
A=zeros(size(A))
replace the matrix adress with a new adress? If so, is alocating new memory faster than reseting existing memeory?
Thank you.

採用された回答

Jos (10584)
Jos (10584) 2014 年 1 月 7 日
To set all elements of an existing array A to zero, A(:)= 0 is recommended (and faster).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by