to speed up 'for' loop
1 回表示 (過去 30 日間)
古いコメントを表示
hello,
i have a loop with the following format:
for n = 1:length(x)
if ....
.....
elseif ....
.......
end
end
I suspect that it takes too long and my program is stuck. the length of 'x' currently 1200 cells and it might vary. How can I speed this up?
thanks,
5 件のコメント
採用された回答
Walter Roberson
2012 年 8 月 1 日
Processing 1200 items in an array would normally take too little time to measure meaningfully, unless the processing for each one takes a long time (in which case that is the problem rather than the for loop.)
I suggest you use the profiler to measure the performance. You could temporarily change the upper bound to something smaller than length(x)
You may wish to consider using waitbar()
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
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!