Re: finding positions of elements in a list

• To: mathgroup at smc.vnet.net
• Subject: [mg86854] Re: finding positions of elements in a list
• From: "Dana DeLouis" <dana.del at gmail.com>
• Date: Sun, 23 Mar 2008 01:04:02 -0500 (EST)

```> I also tried Position but it wasn't clear to me if a pattern can be used
for this.

Hi.  You have answers, but I see you were stuck on using "Position."
Here's one way if you ever need to use it:

pts = {{20, 109}, {21, 50}, {20, 110}, {22, 60}};

Position[pts, {___, n_} /; n > 80]

{{1}, {3}}

Extract[pts, %]

{{20, 109}, {20, 110}}

--
HTH   :>)
Dana DeLouis

"PeterM" <metaxas at lps.u-psud.fr> wrote in message
news:frt5e9\$srg\$1 at smc.vnet.net...
> Hi.
>
> Having a few problems here with what I think should be a simple operation.
I have a list as shown:
>
> 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.
>
> Problem is, I can't work out how to use Select to do this when each
element in the list has an x and a y co-ordinate. If I split the list into x
and y co-ordinates and searched for those y values greater than 80, I would
have a list of those y-values but would not know the corresponding x-values.

>
> I also tried Position but it wasn't clear to me if a pattern can be used
for this.
>
> Thanks in advance, Pete.
>

```

• Prev by Date: Re: ListPlot Joined/Filling bug?
• Next by Date: Re: Saving Packages
• Previous by thread: Re: finding positions of elements in a list
• Next by thread: Re: finding positions of elements in a list