Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##
- To: mathgroup@smc.vnet.net
- Subject: [mg11759] Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##
- From: bawolk@ucdavis.edu (Bruce Wolk)
- Date: Thu, 26 Mar 1998 03:09:28 -0500
- Organization: University of California, Davis
- References: <6f1p6l$ffn@smc.vnet.net>
On 21 Mar 1998 20:23:33 -0500, charles <koehlerc@execpc.com> wrote: >Hello, > >How might I extract a range of {x,y}from a list of data, so that I can >perform a linear fit between the point that meet the criterion of being >bewteen x_n and x_m. > >In other words, fit a line to a part of the data that has #1<x<#2. > >I have attempted to use the Select function but it requires me to >Flatten the data list first? And it results in giving me a list of just >the x values not the {x,y} pairs. > >Any help is greatly appreciated. > >Thanks, > >Charles Koehler > > Select will work, but there is a little trick. The following selects those points with 3<x<5. In[6]:= a={{3,1},{4,2},{5,3},{-4,4}} Out[6]= {{3,1},{4,2},{5,3},{-4,4}} In[7]:= Select[a, 3<#[[1]]<5 &] Out[7]= {{4,2}} Cheers, Bruce