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

조회 수: 1 (최근 30일)
For example
A=[ 1 3 1 1 2 3 5]

채택된 답변

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일
편집: 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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by