Calculate unique number for each type
Show older comments
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
on 20 Dec 2018
u=unique(X);
Y=[u histc(X,u)]
Categories
Find more on MATLAB 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!