[Q] How does one EXPAND an ARRAY in IDL ? i.e opposite of sub-array [message #3419] |
Wed, 25 January 1995 10:14  |
mombasa
Messages: 3 Registered: November 1994
|
Junior Member |
|
|
Hi,
I am dealing with an ARRAY of structures, but the question applies to all
arrays. I know one can take subarrays to shrink an array, but how about if one
wants to extend the size of one how does one achive this. The need arises from
the simple fact that I have a computed array, so when I know that all the
elements in the array are filled I'd wish to extend the array. As I am dealing
with only a 1 dimensional array this should be pretty easy - so I thought.
Thanks in advance.
Tarang
Tarang Kumar Patel phone: (415) 604 4721
NASA Ames Research Center, fax : (415) 604 3594
MS 269-2, Moffet Field, CA 94035-1000 email: mombasa@ptolemy.arc.nasa.gov
The views and opinions stated are my own, and not those of any organization that I may be associated to.
--
Tarang Kumar Patel phone: (415) 604 4721
NASA Ames Research Center, fax : (415) 604 3594
MS 269-2, Moffet Field, CA 94035-1000 email: mombasa@ptolemy.arc.nasa.gov
The views and opinions stated are my own, and not those of any organization that I may be associated to.
|
|
|
Re: [Q] How does one EXPAND an ARRAY in IDL ? i.e opposite of sub-array [message #3500 is a reply to message #3419] |
Thu, 26 January 1995 10:15  |
velt
Messages: 19 Registered: June 1994
|
Junior Member |
|
|
In article <1995Jan25.181418.25048@ptolemy-ethernet.arc.nasa.gov>, mombasa@kronos.arc.nasa.gov (Tarang Kumar Patel) writes:
>
> I am dealing with an ARRAY of structures, but the question applies to all
> arrays. I know one can take subarrays to shrink an array, but how about if one
> wants to extend the size of one how does one achive this.
The basic expansion:
mydata = [mydata, newstructure]
adds one element to the array mydata.
For general expansions you can always use temporary variables.
For example, for a 2-dimensional array of integers:
tmp = intarr( newx, newy)
tmp( 0, 0)= mydata
mydata = tmp
(You may want to clean up tmp afterwards)
Robert Velthuizen (velt@rad.usf.edu),
Digital Medical Imaging Program of the
H. Lee Moffitt Cancer Center and Research Institute at the
University of South Florida, Tampa FL 33612.
|
|
|