comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Making an array of structures containing pointers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Making an array of structures containing pointers [message #15332] Thu, 13 May 1999 00:00 Go to previous message
bowman is currently offline  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 @
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Making an array of structures containing pointers
Next Topic: Re: divide by zero problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 04:23:07 PDT 2025

Total time taken to generate the page: 2.19521 seconds