Let A = [1, 4; 5, 6] and b = [1, 1, 1, 2]. A is here the matrix with the values and b the matrix with the group labels. I would like to sum every item in A according to their label such that I would get something back like c = [10, 6] where thus the labels of b correspond to the indices of c.
How can this be done in MatLab? I already saw accumarray is a logical function to use but it doesn't work on values that aren't vectors.