[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FOR statement
Eli Beckerman wrote:
>
> Hey,
>
> I just tried running a FOR loop in the hopes
> of incrementing the variable "i" by steps of 0.25 as follows:
>
> radius=fltarr(1000)
> FOR i=0.0, 100.0, 0.25 DO BEGIN
>
> radius(i)=i
>
> ENDFOR
>
> And what I end up with is an array that starts
> with the value 0.75 and is incremented by steps of 1.
>
> I'm following the convention of the FOR statement as
> presented in IDL's online help. What am I doing wrong?!
Indexing an array with a floating point number.
try:
FOR i=0.0, 100.0, 0.25 DO BEGIN radius[4*i]=i
or even better:
radius=findgen(401)/4.
JD