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

 Risposta accettata

madhan ravi
madhan ravi il 16 Ott 2018
Modificato: madhan ravi il 16 Ott 2018
Passing the variable is better , see preallocation which enhances speed and efficiency

Più risposte (0)

Categorie

Scopri di più su Fourier Analysis and Filtering in Centro assistenza e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by