Re: IDL data structures question [message #1484 is a reply to message #1398] |
Thu, 23 September 1993 07:22  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
jennifer@gaia.arc.nasa.gov (Jennifer Dungan) writes:
> I wonder if someone could help me with a
> programming problem. In IDL or PV-Wave,
> is it possible to create a data structure
> that has two dimensions, one containing
> an integer scalar, the other containing
> a vector _of variable length_? Basically,
> I want to be able to index some vectors,
> which are of various lengths, so I can loop
> through them. Seems to me I should be
> able to use structures somehow to create
> pointers, but I can't seem to figure it
> out.
> Any pointers (no pun intended) will be appreciated.
> Jennifer Dungan | MS 242-4
> Research Scientist | NASA Ames Research Center
> JCWS, Inc. Tel. (415) 604-3618 | Moffett Field, CA 94035-1000
> email: dungan@gaia.arc.nasa.gov | USA
In IDL you can use anonymous structures to do this. For example:
IDL> MYSTRUC = {MYTAG1: SCALAR_VARIABLE, $
MYTAG2: ARRAY_VARIABLE}
Since the structure doesn't have a name, you can create as many of them as you
want on the fly, each one with a different array size. The only restriction is
that one can't have an anonymous structure within another structure. (Please,
please, please RSI remove this restriction. :^) ).
Bill Thompson
|
|
|