I have a 3 x n array in matlab. I want to create a new 4 x n array that contains all the unique combinations of rows 1 and 2, the sum of the third column for each combination and how many times these unique combinations exist (to get the mean value later).
Is there an efficient way to do this, without using two nested for loops?
Edit: All three rows are numerical values (integers). I used a,b,c,d just for demonstration purposes.
For example:
Unprocessed matrix:
a b b d a a d d
a c d d d a d d
5 5 5 5 5 5 5 5
New matrix:
a b b d a
a c d d d
10 5 5 15 5
2 1 1 3 1