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

Home » Public Forums » archive » Re: help with structure
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: help with structure [message #70295 is a reply to message #70294] Wed, 31 March 2010 14:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sumit writes:

> I want to create a structure with 2 fields. The fields need to be of
> variable length. I need to have 'n' such structures,where 'n' is
> scalar number. To address the issue of variable length field, I create
> pointers for each field( pointing to variable temp for initialization)
> as shown below:
> mystruct={l1:ptr_new(temp), l2:ptr_new(temp)}
> I don't know how to create copies of this structure. Replicate
> doesn't work as I guess it creates shallow copy.

What do you mean it "doesn't work"?

IDL> mystruct={l1:ptr_new(temp), l2:ptr_new(temp)}
IDL> a= replicate(mystruct, 100)
IDL> help, a
A STRUCT = -> <Anonymous> Array[100]
IDL> a[50].l2 = Ptr_New(findgen(11))

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: help with structure
Next Topic: Re: gripe about structures

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

Current Time: Mon Dec 01 20:06:43 PST 2025

Total time taken to generate the page: 1.44545 seconds