Making an array of structures containing pointers [message #15332] |
Thu, 13 May 1999 00:00 |
bowman
Messages: 121 Registered: September 1991
|
Senior Member |
|
|
I'm trying to create a data structure to store a number of variable-length
1-D arrays that I am reading from a file.
I have tried something like this
OPENR, iunit, filename, /GET_LUN ;Open file
n = 0L ;Initialize n to LONG
READU, iunit, n ;Read number of points
temp = {n: n, $ ;Create structure containing pointer
x: PTR_NEW(FLTARR(n))}
READU, iunit, *temp.x ;Read 1-D array
list = temp ;Copy to list
WHILE (NOT(EOF(iunit))) DO BEGIN
READU, iunit, n ;Read number of points
temp = {n: n, $ ;Create structure containing pointer
x: PTR_NEW(FLTARR(n))}
READU, iunit, *temp.x ;Read 1-D array
list = [list, temp] ;Add temp to list <---- FAILS HERE
ENDWHILE
FREE_LUN, iunit
IDL will not let me do the concatenation to concatenate the new structure
(temp) onto the (would be) array of structures, list. It fails with
% Conflicting data structures: TEMP,concatenation.
I can do this successfully
list = [list, list]
to make an array of structures.
List and temp are identical stuctures, why can't I do
list = [list, temp] ?
How do I do what I need to do?
Thanks, Ken
--
Dr. Kenneth P. Bowman, Professor 409-862-4060
Department of Meteorology 409-862-4466 fax
Texas A&M University bowmanATcsrp.tamu.edu
College Station, TX 77843-3150 Replace AT with @
|
|
|
|