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

Home » Public Forums » archive » Re: FOR statement
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: FOR statement [message #24744 is a reply to message #24722] Thu, 12 April 2001 14:04 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Eli Beckerman wrote:
> In defense of myself, I wasn't using the FOR loop to make an array
> (I just excluded all the unnecessary stuff from my posting, and
> seemingly confused everyone even further!)
>
> But clearly, I was mixing the semantics of indexing with assignment
> as Craig pointed out!
>
> FOR i=0, 999 do radius(i) = i * 0.25 is the way to go for what I
> wanted. Thanks for seeing through my morning foggyness.

Eli,

No matter how look at it, your example shows you *are* using a loop to
create an evenly spaced mesh vector. I guess I was trying to say that
using a loop is not the best way to do this in IDL. One of the wisest
pieces of advice I ever received about IDL programming was

"Try to think like an IDL programmer, not a Fortran or C programmer".

In this spirit, I submit that the following method is preferable:

nx = 1000 ; number of values required
dx = 0.25 ; step size
x1 = 0.0 ; start value
radius = lindgen(nx) * dx + x1

You might try changing the number of values to 10,000,000 and seeing
which method is faster.

Cheers,
Liam.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: MAKE_ARRAY question
Next Topic: IDLgrWindow, Map_Patch, and contours

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

Current Time: Fri Oct 10 20:02:52 PDT 2025

Total time taken to generate the page: 0.64424 seconds