How to find if a vector has a repetitive element or not? And its repetition number

1 回表示 (過去 30 日間)
IBM watson
IBM watson 2018 年 10 月 23 日
編集済み: IBM watson 2018 年 10 月 23 日
For example
A=[ 1 3 1 1 2 3 5]
  2 件のコメント
Torsten
Torsten 2018 年 10 月 23 日
What is "repetition number" ? The number of repetitions of each element of A ?
IBM watson
IBM watson 2018 年 10 月 23 日
Yes. I was trying to say that

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

採用された回答

Torsten
Torsten 2018 年 10 月 23 日
編集済み: Torsten 2018 年 10 月 23 日
[a,b] = histc(A,unique(A));
count = a(b)
returns the number of occurences of each element in vector A in array "count".
Best wishes
Torsten.
  2 件のコメント
IBM watson
IBM watson 2018 年 10 月 23 日
Thanks !
IBM watson
IBM watson 2018 年 10 月 23 日
編集済み: IBM watson 2018 年 10 月 23 日
Actually i want to use your code for this:
https://www.mathworks.com/matlabcentral/answers/425580-setdiff-comand-usage?s_tid=mlc_ans_email_view#answer_342895

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

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