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 日

0 投票

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