RE: finding positions of elements in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg86784] RE: [mg86761] finding positions of elements in a list
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Thu, 20 Mar 2008 05:50:35 -0500 (EST)
- References: <200803200755.CAA29380@smc.vnet.net>
Hi Peter, > > mylist={{20, 109}, {20, 110}, {20, 111}, {21, 105}, {21, > 106}, {21, 107},...} > > It's a list of {x,y} co-ordinates of some data points I'm analysing. > > I want to create a new list which contains only those data > points whose y co-ordinate is greater than 80 ie. mylist[[n,2]]>80. You can use Select. You want to select everything based on the second part of every element in the list. Given mylist = {{20, 109}, {20, 110}, {20, 111}, {21, 105}, {21, 106}, {21, 107}}; The command Select[mylist, #[[2]] > 109 &] gets everything with a y-coordinate > 109. Regards, Dave. No virus found in this outgoing message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1335 - Release Date: 19/03/2008 09:54
- References:
- finding positions of elements in a list
- From: PeterM <metaxas@lps.u-psud.fr>
- finding positions of elements in a list