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

Home » Public Forums » archive » Loop through arrays with different names
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 through arrays with different names [message #55185 is a reply to message #55088] Wed, 01 August 2007 19:09 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Aug 1, 5:04 pm, hazel <hazel.ken...@gmail.com> wrote:
> So can I do something like: vx=det+j+arr(i,0)? (Only that clearly
> Otherwise I can reload all my
> different arrays into one array I realise and just loop through that.

What you want to do, if it's at all practical, is put everything into
a single 2D array and access it that way. If that's not practical, you
can do "kludge a" or "kludge b":

;kludge a
IDL> detarrsp=ptrarr(8)
IDL> detarrsp[0]=ptr_new(det1arr)
IDL> detarrsp[1]=ptr_new(det2arr)
; etc.
IDL> for j=0,7 do for i=0,n-1 do
result[i,j]=some_function((*detarrsp[j])[i,0:2])


; kludge b
IDL> for j=1,8 do for i=0,n-1 do success_or_failure= $
execute(string(i,j,j,i,format= $
'("result[",i,",",j,"]=some_function(det",i1.1,"arr[",i, ",
0:2])")'))


"Kludge B" is only for the most desperate of straits, and if it is
possible to put the data into a 2D array, you might as well avoid
"kludge a" as well.

Good luck,

Edward H.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Routine for Converting DN to Radiance to Temperature
Next Topic: Another HDF File Question

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

Current Time: Wed Oct 08 19:32:03 PDT 2025

Total time taken to generate the page: 0.00406 seconds