i've a matrix of 6x4 and i want to count the rows how many times it occur in a matrix
Show older comments
let say the matrix is
A=[ 12 45 67 89
34 56 78 65
12 45 67 89
53 55 21 90
12 45 67 89
53 55 21 90 ]
i want the output to be as:
12 45 67 89 ----- 3 % because it occurs 3 times
34 56 78 65 ------1
53 55 21 90 ------2
plz help me
Accepted Answer
More Answers (1)
Andrei Bobrov
on 8 May 2013
A=[ 12 45 67 89
34 56 78 65
12 45 67 89
53 55 21 90
12 45 67 89
53 55 21 90 ];
[a,c,c] = unique(A,'rows');
out = [a, histc(c,1:max(c))];
Categories
Find more on Creating and Concatenating Matrices 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!