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

Home » Public Forums » archive » Re: arrays as subscripts
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: arrays as subscripts [message #30803 is a reply to message #30797] Thu, 16 May 2002 21:05 Go to previous messageGo to previous message
mperrin+news is currently offline  mperrin+news
Messages: 81
Registered: May 2001
Member
David Fanning <david@dfanning.com> wrote:
> lyubo (lzagorch@cs.wright.edu) writes:
>
>> Suppose I have 3 arrays with the same dimensions: A, B and C.
>>
>> I have to use the non zero elements of A as index to access B, then use
>> the accessed values from B as index to access C, and finally store the
>> values from C in a new array at the previously indexed positions of B.
>>
>> Is there an effective way to do that in IDL? I can write a call to a
>> C function but I was wondering if I can do it only in IDL.
>>
>> Any examples and help would be appreciated.
>
> I'm doing this after a couple of beers, so...
>
> I = Where(A GT 0, count)
> IF count GT 0 THEN BEGIN
> bindex = b[i]
> b[i] = c[bindex]
> ENDIF

He said a new array, though, for the last one, so something like

newarr = fltarr(n_elements(B)) ; or whatever type of arr it is
I = Where(A GT 0, count)
IF count GT 0 THEN BEGIN
newarr[i] = c[b[i]]
ENDIF

I think that's what he was getting at...

- Marshall
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Digital maintenance handbook
Next Topic: Re: Digital maintenance handbook

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

Current Time: Sat Oct 11 04:44:16 PDT 2025

Total time taken to generate the page: 0.88129 seconds