MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: finding positions of elements in a list


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
 



  • Prev by Date: Re: Ordering function
  • Next by Date: Re: floating point issue
  • Previous by thread: finding positions of elements in a list
  • Next by thread: Re: finding positions of elements in a list