[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Frustrating array in structure. Please help
- Subject: Re: Frustrating array in structure. Please help
- From: davidf(at)dfanning.com (David Fanning)
- Date: Tue, 27 Feb 2001 09:16:48 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <97gith$71g$1@newshost.accu.uu.nl>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:23718
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
> PRO NEW_STRUCT, new
> new = {FID, Var1:0.0, data:FLTARR(12,12,12)}
> END
>
> 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()}
Later:
If Ptr_Valid(new.data) THEN *new.data = mydata ELSE $
new.data = Ptr_New(mydata)
Cheers,
David
--
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