dynamic array workaround? [message #45099] |
Sun, 14 August 2005 15:01  |
Jeff N.
Messages: 120 Registered: April 2005
|
Senior Member |
|
|
Hi everyone,
I haven't seen anything in the help files that would lead me to believe
that IDL has a way to do something like the following:
Say I want to loop through a few lists of numbers, and create one big
array of all numbers in the lists that meet some criteria. Since I
don't know beforehand how many numbers will meet the criteria, I don't
know how many elements that one big array will need.
If I were writing code in a language like PERL maybe, I'd use a dynamic
array, but I don't think that IDL supports those. Any idea as to how I
could get around this? What I've been doing is to just initialize a
scalar, then assign new elements to it in the loops, then just removing
the 1st element when I'm done looping. I guess I could also loop
twice, with the first round of loops serving to find out how many array
elements I'd end up needing. Both approaches seem inefficient to me.
What else could I try? I had a sneaky suspicion that the TEMPORARY
function was what I needed, but somehow that doesn't quite look right
either.
Thanks for your help,
Jeff
|
|
|