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

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by