フィルターのクリア

replacing a for loop

1 回表示 (過去 30 日間)
Mnr
Mnr 2015 年 11 月 28 日
コメント済み: Mnr 2015 年 11 月 29 日
Hello all,
I have a simple piece of code that I would like to get rid of the for loop. I would appreciate your help.
for n=1:K
idx=row((((n-1)*dc)+1):(n*dc));
end
where as an example K=4, dc=2, and row=[1;3;2;3;1;4;2;4];

採用された回答

Walter Roberson
Walter Roberson 2015 年 11 月 28 日
t = reshape(row, dc, []);
idx = t(:,1:K);
  1 件のコメント
Mnr
Mnr 2015 年 11 月 29 日
Thank you!

サインインしてコメントする。

その他の回答 (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