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.