[Numpy-discussion] Set values of a matrix within a specified range to zero

Alan G Isaac aisaac@american....
Tue Mar 30 12:12:02 CDT 2010


On 3/30/2010 12:56 PM, Sean Mulcahy wrote:
> 512x512 arrays.  I would like to set elements of the array whose value fall within a specified range to zero (eg 23<  x<  45).

x[(23<x)*(x<45)]=0

hth,
Alann Isaac



More information about the NumPy-Discussion mailing list