MATLAB: Is there an easy way to get all the ordering index of each column of matrix as a matrix form

index ascending order matrix column

The following code gives the matrix M which is what I want. But is there an easier and simpler way to get the matrix M?
if true
a=[1 2 3; -1 5 4; 3 9 -2; 6 3 0]
[B,index] = sortrows(a,1)
[B,index2] = sortrows(a,2)
[B,index3] = sortrows(a,3)
M=horzcat(index,index2,index3)
end

Best Answer

a = [1 2 3; -1 5 4; 3 9 -2; 6 3 0]
[as, M] = sort(a, 1);