Re: [Q] How does one EXPAND an ARRAY in IDL ? i.e opposite of sub-array [message #3409] |
Thu, 26 January 1995 07:55 |
amaravad
Messages: 11 Registered: September 1994
|
Junior Member |
|
|
In article <1995Jan25.181418.25048@ptolemy-ethernet.arc.nasa.gov>,
Tarang Kumar Patel <mombasa@kronos.arc.nasa.gov> wrote:
>
> 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.
This may not be the most efficient answer to your problem. But, Ihave
handled such a situation in the past by simply calling a routine
like 'CONCATENATE_ARRAYS'. Ofcourse this is a routine that you have
to write your self. Write results of computation to a temporary
array, then concatenate this temporary to your main array.
Hope this helps.
ratty
--
Ratnakar Amaravadi Software/Hardware Engineer
Department of Radiology I.U. School of Medicine
(317)274-1843 (w) amaravad@indiana.edu
(317)274-4074 (fax) ratty@foyt.indyrad.iupui.edu
|
|
|
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....
|
|
|