Does 'zeros' overwrite existing memory or alocate new memory and replace adress?
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Daniel
 el 7 de En. de 2014
  
    
    
    
    
    Comentada: Daniel
 el 7 de En. de 2014
            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.
Respuesta aceptada
  Jos (10584)
      
      
 el 7 de En. de 2014
        To set all elements of an existing array A to zero, A(:)= 0 is recommended (and faster).
Más respuestas (0)
Ver también
Categorías
				Más información sobre Performance and Memory en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

