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 
Switch to threaded view of this topic Create a new topic Submit Reply
Making an array of structures containing pointers [message #15332] Thu, 13 May 1999 00:00
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 @
Re: Making an array of structures containing pointers [message #15425 is a reply to message #15332] Thu, 13 May 1999 00:00 Go to previous message
Andrew Kraus is currently offline  Andrew Kraus
Messages: 7
Registered: May 1999
Junior Member
I am thinking that IDL is looking for a named structure. I know that you
have set LIST=TEMP, but I am wondering if IDL isn't going so far as
identify LIST as the same structure type as TEMP. Try the named structure
approach.

Andrew Kraus, MSE
Principal
BioCor, LLC
www.biocor.com
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 15:08:13 PDT 2025

Total time taken to generate the page: 0.00558 seconds