comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: "clamping" an array to a maximum value?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: "clamping" an array to a maximum value? [message #13955 is a reply to message #13951] Mon, 21 December 1998 00:00 Go to previous messageGo to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Kevin Ivory wrote:

> dEdmundson@Bigfoot.com wrote:
>> I have a 2d array of floats. All elements having
>> a value greater than max_val I want to set equal
>> to max_val. My solution is a rather complicated-
>> looking use of the "where" function.
>
> That's easy:
> twod_array = twod_array < max_val
>
> Kevin
> --
> Kevin Ivory Tel: +49 5556 979 434
> Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
> Max-Planck-Str. 2 mailto:Kevin@Ivory.de
> D-37191 Katlenburg-Lindau, GERMANY http://ivory.de/

... but be careful to use parantheses when you want to clamp min and
max at the same time:
twoodle_array = (twoodle_array < max_val ) > min_val

Martin.

--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: segmentation
Next Topic: 3D Scatter plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 10:44:51 PDT 2025

Total time taken to generate the page: 1.99934 seconds