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

1 view (last 30 days)
For example
A=[ 1 3 1 1 2 3 5]

Accepted Answer

Torsten
Torsten on 23 Oct 2018
Edited: Torsten on 23 Oct 2018
[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 Comments
IBM watson
IBM watson on 23 Oct 2018
Edited: IBM watson on 23 Oct 2018
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

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!