Stable accumarray in MATLAB

We can use sortrows as a preprocessing step to sort the indices and corresponding values first, as its documentation states: SORTROWS uses a stable version of quicksort. As the subscripts in subs should be sorted with respect to their linear indices, we need to sort them in reverse lexicographic order. This can be achieved by … Read more