Re: Is there some way of storing conflicting data structures in a single structure/array/??? [message #34349] |
Tue, 04 March 2003 07:08 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Roger (roger_iles@yahoo.co.uk) writes:
> I often end up processing successive data sets that are similar but
> have say a different number of data points. For each run of the loop
> I store the data into a structure. However, as the structure changes
> slightly each time through the loop I can't concatenate the structures
> and have no other way of storing the structures together. If I
> remember rightly, PV-WAVE had a function called 'LIST' which allowed
> you to store structures or arrays of different sizes etc together. Is
> there any way of doing this in IDL, or is there another way around
> this problem.
Perhaps you are thinking of a linked list:
http://www.dfanning.com/programs/linkedlist__define.pro
The only way you can store things of different types (including
different types of anonymous structures) in an array (so you
can concatenate them, for example) is with a pointer array.
ptr = PtrArr(2)
ptr[0] = Ptr_New({a:2, b:IntArr(2)})
ptr[1] = Ptr_New({a:4, b:IntArr(4)})
Print, (*ptr[1]).a
etc.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|