Is this for-loop vectorizable?
1 回表示 (過去 30 日間)
古いコメントを表示
b=1;
for a=2:length(ToneLines)
if ToneLines(a)-ToneLines(b)>13000
b=a;
else
ToneLines(a)=0;
end
end
ToneLines=ToneLines(ToneLines>0);
ToneLines is a vector of positive integers sorted from small to large without any equal elements. Is it possible to vectorize this loop for a better performance?
0 件のコメント
回答 (1 件)
Bruno Luong
2019 年 9 月 24 日
I don't think sequential search can be vectorizable.
You might improve a bit of the search by implementing dichotomy seach rather than linear.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!