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

Home » Public Forums » archive » Re: allocating data to different array on each loop step
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: allocating data to different array on each loop step [message #46257 is a reply to message #46251] Sun, 13 November 2005 20:52 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Richard G. French writes:


> Well, you can use the EXECUTE command if you want to define the variables on
> the fly:
>
>
>
> pro arrays
> for n=1L,10 do begin
> ;create arrays of different sizes
> array=findgen(n)#findgen(10*n)
> ; construct a command to execute, defining the new variable name
> cmd=string(n,format='("array",I0,"=array")')
> print,cmd
> result=execute(cmd)
> endfor
> help
> end
>
>
> IDL> arrays
> array1=array
> array2=array
> array3=array
> array4=array
> array5=array
> array6=array
> array7=array
> array8=array
> array9=array
> array10=array
> % At ARRAYS 8 /Users/rfrench/arrays.pro
> % $MAIN$
> ARRAY FLOAT = Array[10, 100]
> ARRAY1 FLOAT = Array[1, 10]
> ARRAY10 FLOAT = Array[10, 100]
> ARRAY2 FLOAT = Array[2, 20]
> ARRAY3 FLOAT = Array[3, 30]
> ARRAY4 FLOAT = Array[4, 40]
> ARRAY5 FLOAT = Array[5, 50]
> ARRAY6 FLOAT = Array[6, 60]
> ARRAY7 FLOAT = Array[7, 70]
> ARRAY8 FLOAT = Array[8, 80]
> ARRAY9 FLOAT = Array[9, 90]
> CMD STRING = 'array10=array'
> N LONG = 11
> RESULT INT = 1

Humm. I thought he was looking for "efficient". Oh, well,
I guess the old garage sale adage holds for science
concepts, too: What's junk to me, is a treasure for you! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Access to title object in IDLgrAxis
Next Topic: subscripting arrays with dim > 1

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

Current Time: Sat Oct 11 16:03:10 PDT 2025

Total time taken to generate the page: 0.55967 seconds