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

Re: structures, driving me crazy

Luis Alonso wrote:

> 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:???}
> 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.

what you are looking for? The whole array of arr-structs now becomes a
tag of your header structure.

> 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

Sure, no problem.

> So, what am i missing?

I don't know, this should just work fine. Tell me if I misunderstood

  Alex Schuster     Wonko@weird.cologne.de          PGP Key available