reduce running time of for loop
1 回表示 (過去 30 日間)
古いコメントを表示
Assume I have a code as below, how do we rewrite, so we can great reduce running time?
for i = 1: 500
% something to do
end
1 件のコメント
回答 (2 件)
sakshi ahuja
2016 年 3 月 1 日
Function can be formed and relate this to your main work i.e., something u have to do, this will reduce your running time.
0 件のコメント
Jan
2016 年 3 月 1 日
There is no magic command to increase the speed like:
superspeedFor i = 1: 500
% something to do
end
As said before: You have to accelerate "something to do". If you can vectorize this part, the loop can be omitted, which is much faster in many situations.
0 件のコメント
参考
カテゴリ
Help Center および 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!