Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1706 > unrolled thread

Re: SortBy

Started byMichael Stern <nycstern@gmail.com>
First post2011-04-16 11:33 +0000
Last post2011-04-16 11:33 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: SortBy Michael Stern <nycstern@gmail.com> - 2011-04-16 11:33 +0000

#1706 — Re: SortBy

FromMichael Stern <nycstern@gmail.com>
Date2011-04-16 11:33 +0000
SubjectRe: SortBy
Message-ID<iobupf$b9d$1@smc.vnet.net>
SortBy[KS, #[[2]] &]

Cheers,

Michael Stern
Merrin Capital Management

On 4/15/2011 3:56 AM, graser wrote:
> Dear Mathematica group,
>
> I have a simple question for you.
>
> Let's say there is a list like
>
> KS = {{300, 48, 2}, {500, 23, 5}, {120, 55, 7}, {40, 32, 1}};
>
> I want to sort it by second element.
>
> I can use
>
> Sort[KS, #2[[2]]>  #1[[2]]&]
>
> It gives out like
>
> {{500, 23, 5}, {40, 32, 1}, {300, 48, 2}, {120, 55, 7}}
>
> But if I want to use SortBy, how to do that?
>
> SortBy[KS, ??]
>
> Thanks!
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web