Optimization on for loop and if statement
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
Is there any alternative way to improve these statements ?
for i = 1:telegramCount
for k = 1:calculationCount
if(telArray(i,1) == sortedArray(k,3))
firstPlace = k;
break;
end
end
end
Thanks in advance.
0 件のコメント
回答 (1 件)
Vladimir Sovkov
2019 年 11 月 19 日
firstPlace = find ( telArray(i,1) == sortedArray(:,3) ,1 )
replaces your entire "k" loop.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!