MathGroup Archive 1997

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

Search the Archive

Re: Sorting tables by columns


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