Re: Data manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg37719] Re: Data manipulation
- From: "Steve Luttrell" <luttrell at _removemefirst_westmal.demon.co.uk>
- Date: Sat, 9 Nov 2002 00:30:40 -0500 (EST)
- References: <aqfp8e$7d9$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Use this: Cases[data, {_?(# >= 2 && # <= 4 &), _}] Steve Luttrell "Adam Smith" <adam.smith at hillsdale.edu> wrote in message news:aqfp8e$7d9$1 at smc.vnet.net... > I know that this has been covered before, but I could not find it. > > I have a list of data and I want to select a subset based on a > condition. > > A simple example: > > data = > {{0.39501, 10}, {1.65689, 20}, {2.40239, 30}, {3.27252, 40}, {4.41738, > 50}} > > I want to select only the pairs for which the first element of each > pair is greater than or equal to 2.0 and less than 4.0 In this case > the final result would be > > {{2.40239, 30}, {3.27252, 40}} > > In reality the list is several hundred pairs. > > Thanks > > Adam >