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

Home » Public Forums » archive » Collection of different size arrays?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Collection of different size arrays? [message #40194] Tue, 13 July 2004 15:10
Jonathan Greenberg is currently offline  Jonathan Greenberg
Messages: 91
Registered: November 2002
Member
I'm unfamiliar with the use of structures, but I'm guessing this is the
answer. Lets say I have some program generate arrays using the following
algorithm:

For I=1,5 do begin
temparr=fltarr(i)
Endfor

I want to "collect" all of the temparr that are created within the loop such
that I can access each array by some sort of index (which would be from 0 to
4) -- e.g. I want to be able to do something like:

A = temparr at index 2
Print,A
--> (0,1)

An obvious solution is to put "0s" in and make a 2d array, where the row is
the index, so I get something like

0,0,0,0,0
0,1,0,0,0
0,1,2,0,0
0,1,2,3,0
0,1,2,3,4

However, this takes up a lot of space and the nature of the algorithm I want
to use I would like to have smaller arrays be "compressed" without having to
crop them each time.

What do I put inside the for loop to generate:
1:0
2:0,1
3:0,1,2
4:0,1,2,3
5:0,1,2,3,4

???

Thanks!

--j

--
Jonathan Greenberg
Graduate Group in Ecology, U.C. Davis
http://www.cstars.ucdavis.edu/~jongreen
http://www.cstars.ucdavis.edu
AIM: jgrn307 or jgrn3007
MSN: jgrn307@msn.com or jgrn3007@msn.com
[Message index]
 
Read Message
Previous Topic: Re: dynamic pull down menus, removing items
Next Topic: fsc_surface update

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

Current Time: Sat Nov 29 23:18:57 PST 2025

Total time taken to generate the page: 0.24050 seconds