optimize the end statement in a for loop
古いコメントを表示
I have a loop that runs millions of times that cannot be arrayed. Using the profiler I've noticed some of the lines that take up the most time are the end statements. Are there any ways to make the end statement of the for loop more efficient such as preallocation of single variables or clearing variables before the end of a loop?
1 件のコメント
ES
2014 年 1 月 24 日
If in the loops you use, you keep changing the dimension of arrays (by append operation or so), then pre-allocation saves time.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!