[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array structure--in a structure



Marianne wrote:
> 
> I want to define a structure containing arrays of structures. Is this
> possible without using pointers?
> 
> E.g..
> 
> tmp1={AA,a:1,b:2}
> tmp2={BB,CC:AA(12)}
> 
> I realize this is not correct code, but what is?

tmp2={BB,CC:replicate({AA,a:1,b:2},12)}

then you can do

tmp2.cc.a=findgen(12)

etc.  But you'd better hope you don't later want 11 or 13 AA's, because
without pointers, you're stuck.

JD

-- 
 J.D. Smith                  |   WORK: (607) 255-6263
 Cornell Dept. of Astronomy  |         (607) 255-5842
 304 Space Sciences Bldg.    |    FAX: (607) 255-5875  
 Ithaca, NY 14853            |