For anyone reading this, messing around with it, this also works. Data is the original array, sorted is the sorted first layer of data, and newRates is the sorted second layer of data that we're creating.
[sorted, index] = sort(data, 2);
newRates = zeros(size(sorted,1), size(sorted,2));
for ii = 1:(size(data,1))
for jj = 1:(size(data,2))
newRates(ii,jj) = data(ii, index(ii, jj), 2);
end
end
sorted(:,:,2) = newRates;