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

 채택된 답변

madhan ravi
madhan ravi 2018년 10월 16일
편집: madhan ravi 2018년 10월 16일
Passing the variable is better , see preallocation which enhances speed and efficiency

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

질문:

2018년 10월 16일

편집:

2018년 10월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by