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

Home » Public Forums » archive » delete a tagname from a 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 a tagname from a structure? [message #86002 is a reply to message #9715] Mon, 23 September 2013 14:55 Go to previous messageGo to previous message
spluque is currently offline  spluque
Messages: 33
Registered: September 2013
Member
Hi,

Searching for a way to remove a field from a structure, I found this advice from 1997. Is there a better way to do this nowadays, in the most general way suggested by JD Smith below?

Thanks,
Seb



On Friday, August 8, 1997 2:00:00 AM UTC-5, J.D. Smith wrote:
> R. Bauer wrote:
>>
>> Hi,
>>
>> I like to remove a tagname from a structure.
>>
>> Any ideas?
>>
>> --
>> R.Bauer
>>
>> Institut fuer Stratosphaerische Chemie (ICG-1)
>> Forschungszentrum Juelich
>> email: R.Bauer@fz-juelich.de
>
>
> st={tag1:1,tag2:2,tag3:3,tag4:4} ; a structure
> tags=tag_names(st)
> list=[0,1,3] ;; list of which elements to keep
> st=create_struct(tags[list],st.(list[0]),st.(list[1]),st.(li st[2]))
>
>
> If you have a named struct, you can use
> name=tag_names(st,/STUCTURE_NAME) and create_struct(name=name,...)
>
> For a totally general method which doesn't preassume the number of tags
> to keep, you'd have to build an 'execute' statement.
>
> E.g.
>
> n=strtrim(n_elements(list),2)
> exc='st=create_struct(tags[list],'+string(FORMAT='('+n+'("st.(list[ ",I0,"])",:,","))',indgen(n_elements(list)))+')'
> out=execute(exc)
>
> JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: A newbie question regarding 3D plotting
Next Topic: Does the IDLDE regularly hang for anyone else?

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

Current Time: Wed Oct 08 18:16:40 PDT 2025

Total time taken to generate the page: 0.00435 seconds