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

Home » Public Forums » archive » Delete element from the structure inside another 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: Delete element from the structure inside another structure [message #88943 is a reply to message #88936] Mon, 07 July 2014 01:50 Go to previous messageGo to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
Hi Andrii,

I think you can't do that directly. You have two choices: either create a new structure in the shape you want, and explicitly copy over the elements you want to retain (struct_assign), or -- probably the better solution -- use a pointer in the first place, so that:

a = { f1: 0, f2: { x: ptr_new(FltArr(10,10,10)), y: 0}}

then you could set a.f2.x=ptr_new(FltArr(5,5,5)) and access with

print,*(a.f2.x)

If you want to be able to change all the values, put the pointers at the lowest level, and recreate the structures each time:

a=ptrarr(2)
a[0]=ptr_new(0)
a[1]=ptr_new({ x: ptr_new(FltArr(10,10,10)), y: 0})

or

a[1]=ptr_new({ x: ptr_new(FltArr(5,5,5)), y: 0})

cheers,
Greg
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: multi-layer tiff file
Next Topic: Plotting the region of interest from satellite image

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

Current Time: Wed Oct 08 15:26:30 PDT 2025

Total time taken to generate the page: 0.29022 seconds