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

Home » Public Forums » archive » Re: idl array operations
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: idl array operations [message #47768 is a reply to message #47767] Tue, 28 February 2006 15:26 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
alex922@gmail.com wrote:
> Hi,
>
> I'm pretty new to IDL and someone told me to avoid loops.
>
> I have the following problem. I have an array of elements whose values
> range from 0 to 360, and I have to subtract a number if the value is
> greater than 180.
>
> My initial reaction is to create a loop and use condition statements to
> perform the calculations.
>
> Is there a 'one liner' array operation which would allow me to do this
> without using loops?

Dunno about a one-liner:

loc=where(data gt 180.0,count)
if (count gt 0) then data[loc]=data[loc]-number

There's probably a solution via HISTOGRAM, too. :o)

paulv


--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem with dual monitor setup
Next Topic: Help in Image Analysis

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

Current Time: Wed Oct 08 19:29:06 PDT 2025

Total time taken to generate the page: 0.00460 seconds