Calculate unique number for each type

2 views (last 30 days)
Billie Jaya
Billie Jaya on 20 Dec 2018
Answered: madhan ravi on 20 Dec 2018
Hi guys,
I need help to count duplicate number for each type
The example of the result is like this :
X = Input
Y = Output
X=[2 ;2 ;1 ;3 ;5; 4]
Y= [1 1;2 2;3 1; 4 1; 5 1]
X=[2 ;2 ;2 ;3 ;5; 4]
Y= [1 0;2 3;3 1; 4 1; 5 1]
Can someone help me? thanks

Answers (1)

madhan ravi
madhan ravi on 20 Dec 2018
u=unique(X);
Y=[u histc(X,u)]

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!