Is there a function in MATLAB that sorts a bidimensional array?
This is how I would like to sort it:
The matrix:
$\left(\begin{array}{c c c} 9 & 4 & 7\\ 1 & 5 & 2\\ 3 & 6 & 8 \end{array}\right) $
will become:
$\left(\begin{array}{c c c} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{array}\right) $
It should be possible by vectorizing of the original matrix and subsequent reshaping
>> A = [9 4 7; 1 5 2; 3 6 8 ]>> reshape(sort(A(:)),size(A))'If you need to know original indices, function
sortis able to return them. But it returns indices of vectorized matrix and thereforeind2subhas to be used