[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Structure field concatenation
- Subject: Structure field concatenation
- From: Ben Tupper <pemaquidriver(at)tidewater.net>
- Date: Thu, 31 Aug 2000 11:02:11 -0400
- Newsgroups: comp.lang.idl-pvwave
- Organization: http://extra.newsguy.com
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:21226
Hello,
I know that this has been a subject of some discussion recently... but
I'm still not on firm footing on the best method of changing the size of
an anonymous structure's fields (i.e. I want to increase or decrease the
size of a field). The code below shows an example of how I do it now:
creating a new structure with the appropriately sized fields. Is there
a better method?
;++++++++++++ START
PRO Concatenate_Str_Fields
D = {A:Indgen(12), B:Indgen(12)} ;define a dummy structure
Help, D, /STR
Tags = Tag_Names(D)
NewD = Create_Struct(Tags[0], [D.(0), Indgen(10)]) ;define the new
structure with amended field
For i = 1, N_ELEMENTS(Tags) -1 Do $ ;for each tag recreate
the structure
NewD = Create_Struct( NewD, Tags[i],[D.(i), Indgen(10)] )
Help, NewD, /STR
END
;--------------------END
Thanks,
Ben
BTW: I don't want to steer the discourse toward a scandalous sidebar
discussion, but... I'm wrestling with this because a shrimp starts out
as a male and then ends up as a female a few years later. I'm working
with a database that has the shrimp broken down into records by sex...
but I need to add new records for aggregate sex (that is the sum of
males, transitionals, females,...) I never thought IDL programming
could be so titillating.
--
Ben Tupper
248 Lower Round Pond Road
POB 106
Bristol, ME 04539
Tel: (207) 563-1048
Email: PemaquidRiver@tidewater.net