Re: simplest way to sort a bi-dimensional array? mat(a,b)...



Il 26/07/2007, dpb ha detto :
ginko wrote:
Let's take a simple example :
Suppose you have the following initial matrix; 4 rows 3 columns

row(1) 12 10 7
row(2) 4 8 11
row(3) 9 5 2
row(4) 1 3 6

After the sort what do you expect to see ?

(a) Sorted ascending in both column and row
row(1) 1 2 3
row(2) 4 5 6
row(3) 7 8 9
row(4) 10 11 12

this one!!!

That one actually is probably the simplest -- consider the array as a vector, sort, then reshape.

how to sort the array?


.



Relevant Pages