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 #47766 is a reply to message #47764] Tue, 28 February 2006 15:34 Go to previous messageGo to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1141168957.087822.106350@i39g2000cwa.googlegroups.com>, "alex922@gmail.com" <alex922@gmail.com> writes:
> 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?
>
> Thanks,
> Alex
>
Taking your array as arr and the nuber to be subtracted as x, the line
would be
arr = arr - x*(arr gt 180)

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
[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:31:10 PDT 2025

Total time taken to generate the page: 0.01379 seconds