Re: saving arrays within loop [message #53592] |
Sun, 22 April 2007 08:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
metachronist writes:
> I have binary datafiles (daily records for every minute from a given
> station) which I could read using anonymous structures without any
> problem. What I am trying to do is to read data from different
> stations and group them into one big array, having indices =
> (number_of_stations, data_having_dimensions_of_dim).
>
> For example, I have tried this.. Outside the loop, I define the struct
> and replicate the struct and within the loop, read the complete
> datafile ('data', having dimensions of1440,31) from different
> stations.
I am confused. If you can read these data files into
anonymous structures, and you make an ARRAY of
these anonymous structures, why can't you just
loops through the data files, reading each file,
and then storing the data in the appropriate location
in your array of structures? In the end, you will
have (or can easily create) what you want.
> But only, the last station values get stored?! Do I need to index the
> individual station temp values? I didn't think so.
Well, if only the last station values get stored, then
I would think the ONLY solution would be to index the
station values. But I can't really tell from your description
what you think that means.
> What is it that I am doing which is so obviously wrong?
I think you are trying to make it too hard. If you already
have something that works, just do that thing for all your
data files. In the end, you can treat your array of structures
in the way you apparently want to treat your data.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: saving arrays within loop [message #53738 is a reply to message #53592] |
Mon, 23 April 2007 06:17  |
rkombiyil
Messages: 59 Registered: March 2006
|
Member |
|
|
On Apr 23, 12:04 am, David Fanning <n...@dfanning.com> wrote:
> metachronist writes:
>> I have binary datafiles (daily records for every minute from a given
>> station) which I could read using anonymous structures without any
>> problem. What I am trying to do is to read data from different
>> stations and group them into one big array, having indices =
>> (number_of_stations, data_having_dimensions_of_dim).
>
>> For example, I have tried this.. Outside the loop, I define the struct
>> and replicate the struct and within the loop, read the complete
>> datafile ('data', having dimensions of1440,31) from different
>> stations.
>
> I am confused. If you can read these data files into
> anonymous structures, and you make an ARRAY of
> these anonymous structures, why can't you just
> loops through the data files, reading each file,
> and then storing the data in the appropriate location
> in your array of structures? In the end, you will
> have (or can easily create) what you want.
>
>> But only, the last station values get stored?! Do I need to index the
>> individual station temp values? I didn't think so.
>
> Well, if only the last station values get stored, then
> I would think the ONLY solution would be to index the
> station values. But I can't really tell from your description
> what you think that means.
>
>> What is it that I am doing which is so obviously wrong?
>
> I think you are trying to make it too hard. If you already
> have something that works, just do that thing for all your
> data files. In the end, you can treat your array of structures
> in the way you apparently want to treat your data.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Yes, you were right :) It was a mistake with the declaration, being
the lazy sort, I didn't wanna go through the many lines of code (tho
they are my creation!) :p
Thanks for your time. I appreciate it.
~rk
|
|
|