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

 采纳的回答

Passing the variable is better , see preallocation which enhances speed and efficiency

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by