MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: newbie question on sorting


Just Sort your matrix (btw, try to avoid capital letters to name your 
objects). E.g.:

In[1]:=
mat = Table[Random[Integer, {0, 9}], {4}, {3}]
Out[1]=
{{3, 5, 0}, {8, 2, 1}, {3, 9, 4}, {1, 6, 2}}

In[2]:=
Sort[mat]
Out[2]=
{{1, 6, 2}, {3, 5, 0}, {3, 9, 4}, {8, 2, 1}}

Tomas Garza
Mexico City

"niels Waller" <niels.waller at home.com> wrote:

> I have just started using Mathematica for a programming task and have 
run
> into a difficulty.  I have a matrix M. I would like to sort the rows 
of M
> based on the values of the first column.  Is there any easy way to do 
this?
> Any and all help will be greatly appreciated.



  • Prev by Date: Re: newbie question on sorting
  • Next by Date: Re: Question: nonlinear differential equation with boundary conditions
  • Previous by thread: Re: newbie question on sorting
  • Next by thread: RE: newbie question on sorting