|
[Date Index]
[Thread Index]
[Author Index]
Re: Sort problem
- To: mathgroup at smc.vnet.net
- Subject: [mg56343] Re: Sort problem
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Fri, 22 Apr 2005 06:23:33 -0400 (EDT)
- Organization: University of Washington
- References: <d47suf$54n$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
<konstantpi at mail15.com> wrote in message news:d47suf$54n$1 at smc.vnet.net...
> Hi
> How to sort two lists such as:
> age={30,12,60,20};
> pple={"john","kate","peter","alice"};
>
> to give the output:
> age={12,20,30,60}
> pple={"kate","alice","john","peter"}
>
> ie: to keep every person opposite his age number.
> thanks
>
Use Ordering.
ord=Ordering[age];
age=age[[ord]]
pple=pple[[ord]]
will do what you want.
Carl Woll
Prev by Date:
Re: Sort problem
Next by Date:
Re: Sort problem
Previous by thread:
Re: Sort problem
Next by thread:
Re: Sort problem
|