[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deleting structure element



Yes, it is

look at 

delete_tag : This functions deletes a tag in a structure, even 
within substructures. There is no problem deleting a tag from a
subsubsub
structure.

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_html/dbase/download/delete_tag.tar.gz

or

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_html/dbase/download/delete_tag.sav

also available:

add_tag : This functions adds a tag on an arbitrary level of a 
structure. 


replace_tagvalue: This functions replaces a tag in a structure or 
sub structure 


Reimar Bauer

; EXAMPLE:
;   d = {A: 1, B: {B1: 0, B2: 1}, C: {B1: 0, B2: 1}}
;
;   result = delete_tag(d, 'B')
;   help, result, /str
;   ** Structure <1342678>, 2 tags, length=8, refs=1:
;   A               INT              1
;   C               STRUCT    -> <Anonymous> Array[1]
;
;   result = delete_tag(d, ['B*'], SUB = 'C')
;   help, result, /str
;   ** Structure <13694a8>, 2 tags, length=6, refs=1:
;   A               INT              1
;   B               STRUCT    -> <Anonymous> Array[1]
;
;   result = delete_tag(d, '*B1', SUB = ['B', 'C'])
;   help, result.b, /str
;   ** Structure <1331be8>, 1 tags, length=2, refs=1:
;   B2              INT              1
;
;   result = delete_tag(d, ['B1', 'B2'], /ALL)
;   help, result, /str
;   ** Structure <170fac8>, 1 tags, length=2, refs=1:
;   A               INT              1
;
;   help,(delete_tag(d,'b1',sub_structure='B')).b,/str
;   B2              INT              1
;
;   help,(delete_tag(d,'b1',sub_structure='B')).c,/str
;   ** Structure <1333618>, 2 tags, length=4, refs=1:
;   B1              INT              0
;   B2              INT              1
;
;   help,(delete_tag(d,'*',sub_structure='B')),/str
;   ** Structure <133b2d8>, 2 tags, length=6, refs=1:
;   A               INT              1
;   C               STRUCT    -> <Anonymous> Array[1]
;
;   help,(delete_tag(d,'*',sub_structure='B',/sort)),/str
;   ** Structure <d40daa8>, 2 tags, length=6, refs=1:
;   A               INT              1
;   C               STRUCT    -> <Anonymous> Array[1]
;
;   help,(delete_tag(d,sub_structure=['B','A'])),/str
;   ** Structure <132fe78>, 2 tags, length=6, refs=1:
;   A               INT              1
;   C               STRUCT    -> <Anonymous> Array[1]
;
;   help,(delete_tag(d,sub_structure=['B','C'])),/str
;   ** Structure <1333288>, 1 tags, length=2, refs=1:
;   A               INT              1
;
;   help,(delete_tag(d,['B1','B2'],sub_structure=['B','C'])),/str
;   ** Structure <46a9498>, 1 tags, length=2, refs=1:
;   A               INT              1
;
;   d = {ABRA: {B1: 0, B2: 1}, ABRA2B: {B1: 0, B2: 1}, ABRA3B: {B1: 0,
B2: 1}}
;
;   result=delete_tag(d,'abra')
;   help,result,/str
;   ** Structure <1365a48>, 2 tags, length=8, refs=1:
;   ABRA2B          STRUCT    -> <Anonymous> Array[1]
;   ABRA3B          STRUCT    -> <Anonymous> Array[1]
;
;   result=delete_tag(d,'abra*')
;   help,result,/str
;   RESULT          INT       =       -1
;
;   result=delete_tag(d,'abra?B')
;   help,result,/str
;
;   ** Structure <1364358>, 1 tags, length=4, refs=1:
;   ABRA            STRUCT    -> <Anonymous> Array[1]
;
;   d = {ABRA: {B1: 0, B2: {A:1}}, ABRA2B: {B1: 0, B2: {A:1}}, ABRA3B:
{B1: 0, B2: {A:1}}}
;   result=delete_tag(d,'A',sub_structure='abra.b2')
;   help,result.abra,/str
;   ** Structure <1365c68>, 1 tags, length=2, refs=2:
;   B1              INT              0
;