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

Re: Frustrating array in structure. Please help

Sean Heukels (sean77=cuthere=@dds.nl) writes:

> I' ve been trying everuthinh for hours now.
> I define a structure in a subroutine when starting, as follows
> new = {FID, Var1:0.0, data:FLTARR(12,12,12)}
> The problem is that after the structure has been defined, I can only findout
> what size the array must have that I call 'data'.  So the FLTARR is phony,
> just to keep the structure happy. Some example normal size would be
> FLTARR(64,64,2,1,100). I tried adjusting it later, but I couldn't.
> How do I do this ? Can I set data:[] or something, so as to show that I'm
> not finished defining it yet ? The data array size is always different,
> thats the problem.
> Does anyone have a clue ??

Pointers, my man, pointers! :-)

 new = {FID, Var1:0.0, data:Ptr_New()}


   If Ptr_Valid(new.data) THEN *new.data = mydata ELSE $
      new.data = Ptr_New(mydata)



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155