Passing the variable is fast or creating the variable new variable is fast?

Lets take an exapmle:
n=100; target to generate s=zeros(n,n);
should I pass this s or generate locally in the function?
I have to run the function, let say 10000 iteration

 Respuesta aceptada

madhan ravi
madhan ravi el 16 de Oct. de 2018
Editada: madhan ravi el 16 de Oct. de 2018
Passing the variable is better , see preallocation which enhances speed and efficiency

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 16 de Oct. de 2018

Editada:

el 16 de Oct. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by