MathGroup Archive 1997

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

Search the Archive

Re: Sorting tables by columns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6403] Re: [mg6385] Sorting tables by columns
  • From: BobHanlon at aol.com
  • Date: Sun, 16 Mar 1997 19:25:17 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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

To sort on column n:

n = 1; Sort[A, #1[[n]] < #2[[n]]&]

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

n = 3; Sort[A, #1[[n]] < #2[[n]]&]

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


Bob Hanlon


  • Prev by Date: Re: Re: REQ: (a+b)n
  • Next by Date: Sorting tables by columns
  • Previous by thread: Sorting tables by columns
  • Next by thread: Sorting tables by columns