Re: [Q] How does one EXPAND an ARRAY in IDL ? i.e opposite of sub-array [message #3416 is a reply to message #3409] |
Wed, 25 January 1995 12:11  |
ryba
Messages: 33 Registered: October 1992
|
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 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.
(Don't blame me his lines are too long)
To extend an array of structures, use REPLICATE()
let S be an array of structures, of type SSNAME
S = [temporary(S), replicate({SSNAME}, n_new_elements)]
if you just have a structure tag and aren't appending data, you can
avoid the concatenation operator and just use replicate (I do that all
the time to create the array of structures prior to a READU or other
input statement).
Also note the use of TEMPORARY(). To extend an anonymous
structure, you can replace {SSNAME} with S(0).
--
Dr. Marty Ryba | Generation X:
MIT Lincoln Laboratory | Too young to be cynical,
ryba@ll.mit.edu | too old to be optimistic.
Of course nothing I say here is official policy, and Laboratory affiliation is
for identification purposes only, blah, blah, blah....
|
|
|