フィルターのクリア

Is it possible to remove this for loop to speed up the processing?

2 ビュー (過去 30 日間)
feng hongchuan
feng hongchuan 2016 年 1 月 20 日
コメント済み: feng hongchuan 2016 年 1 月 21 日
I have following loop in my codes:
for n=1:Na
sig1(n,m) = sig(n,m+RCM(n));
end
where Na is a large number,28001;
the row number of sig1 and sig are the same;
the column of sig is larger than that of sig1;
RCM is a Nax1 vector.
Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 20 日
N = 1 : Na;
sR = size(sig,1);
sig1((m-1)*sR + N) = sig((m+RCM-1)*sR + N);
No looping.
The above code uses linear indexing and uses knowledge of how to convert 2D indices into linear indices.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by