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

Home » Public Forums » archive » Re: Loop question
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: Loop question [message #20398] Mon, 19 June 2000 00:00
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
Hello Kyle,
Maybe the following will work for you:

samples=256
temp_arr=FLTARR(samples)
data_arr=FLTARR(5000)
ind_arr=LONG(LINDGEN(1000)*0.256)

key_arr = [0, where(ind_arr - shift(ind_arr, 1) eq 1)]
temp_arr = data_arr[key_arr]

This will work with the way of filling of IND_ARR that you provided. In
the given example, it also looks to me that temp_arr can never receive
any values subsequent to data_arr[999].

Cheers,
Pavel

"R. Kyle Justice" wrote:
>
> Can the following FOR loop be vectorized?
>
> samples=256
> temp_arr=FLTARR(samples)
> data_arr=FLTARR(5000)
> ind_arr=LONG(LINDGEN(1000)*0.256)
>
> FOR j=0L,samples-1 DO BEGIN
> temp_ind=WHERE(j EQ ind_arr)
> temp_arr(j)=data_arr(temp_ind(0))
> ENDFOR
>
> Kyle J.
[Message index]
 
Read Message
Previous Topic: File modification date
Next Topic: Loop question

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

Current Time: Fri Oct 10 23:06:43 PDT 2025

Total time taken to generate the page: 1.28220 seconds