structures, driving me crazy [message #22577] |
Fri, 24 November 2000 00:00 |
Luis Alonso
Messages: 27 Registered: February 2000
|
Junior Member |
|
|
Hi!
I have a dataset of images with corresponding header files.
The header files (which i want to read) consist of three float numbers, and
then 9 rows of data with 8 elements each. Each row corresponds to a spectal
band of the image.
i've got 138 images all related, so i want to have all the headers open and
related.
I thought about creating a structure for each band:
att={roll:0.0,pitch:0.0,head:0.0,utme:0L,utmn:0L,alt:0.0,vel :0.0}
and then create an array of structures
band=replicate(att,9)
then create a header structure
header={date:'',sunazi:0.0,sunzen:0.0,bias:0.0,band:???}
and then replicate it for the whole set:
image=replicate(header,138)
of course i found several problems. First, i didn't know how to initialize
the tag band as a structure array of the type band in the structure
definition of header.
second, i tryed to use concatenation of structures, of the kind:
p = CREATE_STRUCT('A', 1, 'B', 'xxx')
p = CREATE_STRUCT('FIRST', 0, p, 'LAST', 3)
so i tried:
header=create_struct('date',"",'sunazi',0.0,'sunzen',0.0,'bias',0.0,band)
i know there are workarounds, as using separate structures for bands and the
rest of the header... but i thought there MUST be a way of putting it all
together, and being able to access data as:
image[102].date
as well as
image[102].band[3].utme
So, what am i missing?
David, i guess this is somehow explained in your book, and i'm getting it
for christmass. But i'd like to have the answer a bit sooner ;)
Greetings,
Luis =)
|
|
|