MathGroup Archive 2010

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

Search the Archive

List Manipulation: Conditionally changing y value when x value meets some criteria


Hello, 

 

If possible I could use a little help on this.

 

I have a list of  x and y data and based on the value of x I would like to
manipulate the value y.

I joined the data using:

pts=MapThread[{##1}&,{x,y}]

I assumed that by testing the x value using #[[1]], I could change the value
of y using #[[2]] as shown below.  If no manipulation was required based on
the value of x, I would keep that point unchanged, but I'm definitely
missing something.

 

filtered=If[a<#[[1]]&<b,#[[2]]&=0],{#[[1]],#[[2]]}&,pts]

 

a and b are the range of x values

 

 

Any insight would be much appreciated.

 

Thanks,

 

Chuck Koehler


  • Prev by Date: evaluate the floor s to yield a number
  • Next by Date: Plot and advanced filling
  • Previous by thread: Re: evaluate the floor s to yield a number
  • Next by thread: Re: List Manipulation: Conditionally changing y value when x value meets some criteria