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

MathGroup Archive 1997

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

Search the Archive

Re: Sorting tables by columns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6397] Re: Sorting tables by columns
  • From: "Edward G. Neuman" <edneuman at math.siu.edu>
  • Date: Sun, 16 Mar 1997 19:25:09 -0500 (EST)
  • Organization: Unknown Organization
  • Sender: owner-wri-mathgroup at wolfram.com


fbd2 at psu.edu wrote in article <5gdg7k$kmm at smc.vnet.net>...
> Hi,
> 
> Does anyone know how to sort tables by one of its columns? 
> For example,  the table
> 
> 2  3  4  5
> 1  2  7  8
> 6  9  2  1
> 
> can be sorted by column 1, giving:
> 
> 1  2  7  8
> 2  3  4  5
> 6  9  2  1
> 
> This can be done using Excel; however I need to perform
> this operation inside a Mathematica program.
> Is there an automated procedure in Mathematica to accomplish this?
> 
> Thanks,
> 
> Flavio
> 
> 

You can use function Sort:

A={{2,3,4,5},{1,2,7,8},{6,9,2,1}};

Sort[A]//MatrixForm

1   2   7   8

2   3   4   5

6   9   2   1


====================================================
Edward Neuman
E-mail: edneuman at siu.edu
http://www.math.siu.edu/neuman/personal.html


  • Prev by Date: Mathematica Journal Article electronic submission mystery
  • Next by Date: FrameLabel->
  • Previous by thread: Sorting tables by columns
  • Next by thread: Re: Sorting tables by columns