Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: newbie question on sorting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26454] Re: [mg26420] newbie question on sorting
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Thu, 21 Dec 2000 01:51:56 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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