フィルターのクリア

How to find repeat element of vector?

1 回表示 (過去 30 日間)
Saiem Solimullah
Saiem Solimullah 2018 年 5 月 13 日
編集済み: Matt J 2018 年 5 月 13 日
Suppose, i have a matrix b=[1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1] and i want to find the repeated element of this matrix by 3 times using for loop . as the new matrix will be a=[1 0 1 1 0 0 1 1] . How easily can solve using for loop ??
  2 件のコメント
Matt J
Matt J 2018 年 5 月 13 日
Why using a for loop?
Image Analyst
Image Analyst 2018 年 5 月 13 日
what is the repeated element? 1, which is repeated many times. 0, which is repeated many times? 11, which is repeated many times? 00 which is repeated many times. 1 1 1 1 1 1 which is repeated twice? And so on. Or is it just the first elements before a zero occurs, 111, which will occur 9 times? Please explain. Also explain what "by 3 times" means because I have no idea. Do you want to find the repeated element location three times instead of just once for some unexplained reason?

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

採用された回答

Matt J
Matt J 2018 年 5 月 13 日
編集済み: Matt J 2018 年 5 月 13 日
for i=1
a=b(1:3:end);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by