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

Home » Public Forums » archive » Structure field concatenation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Structure field concatenation [message #21666 is a reply to message #21614] Wed, 06 September 2000 07:16 Go to previous messageGo to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Amara Graps wrote:
>
> (at the risk of being the only one here who still hasn't
> figured this out)
>

Reset.

Now try again from scratch:

;; create template structure and structure array
template = {orbit:'',freq:ptr_new()}
periodcube = replicate(template, 20)

;; fill first element with data
periodcube.orbit = 'G2'
periodcube.freq = Ptr_New( DIndgen(100) )

;; Work with data
plot, *(periodcube.freq), title=periodcube.orbit

;; Free all pointers
Ptr_Free, periodcube.freq


You probably didn't want to use a second Ptr_New statement out of
fear that would allocate extra memory and create a memory leak.
This is no problem, because the Ptr_New() statement with no
argument only "declares" a pointer but does not allocate any
memory for the data it will eventually point to. Only if you want
to replace the data in a structure element, then you need to free
the pointer beforehand:

;; Replace data of first structure
IF Ptr_Valid(periodcube.freq) THEN Ptr_Free,
periodcube.freq
periodcube.freq = Ptr_New( DIndgen(200)*0.1 )


Hope this will clear your mind,
Martin


PS:
> "Never fight an inanimate object." - P. J. O'Rourke
No, it's far better to write them ;-)

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie
[[
[[ Bundesstr. 55, 20146 Hamburg
[[
[[ phone: +49 40 41173-308
[[
[[ fax: +49 40 41173-298
[[
[[ martin.schultz@dkrz.de
[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDLgrROI and normalized coords
Next Topic: Re: taking the widget plunge. help

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

Current Time: Wed Oct 08 19:59:27 PDT 2025

Total time taken to generate the page: 0.00331 seconds