Suppose I have a matrix like this:
x=[ 1 2 4 5 6; 2 2 3 3 3]
and based on the frequency of elements in the 2nd column I need to make summation to all perspective elements in the 1st column The desired output is:
y=[3 15; 2 3]
The first column: 3= 2+1 & 15= 4+5+6, The second column: unique values of x
Thank you in advance
Best Answer