Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array [message #65210 is a reply to message #65209] |
Sun, 15 February 2009 10:39  |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Feb 15, 6:27 pm, David Fanning <n...@dfanning.com> wrote:
> polystethylene writes:
>> I've tried two approaches. First of all, I've tried reading each file
>> into the array 'framearray', and then subsequently (within the loop)
>> placing the 2-d array (framearray) into the 3-d array (data), with
>> something like this:
>
>> data[*,*,i] = framearray
>
>> but this complains that array is the wrong size. (I assume its
>> possible to put a smaller array into a larger array without IDL
>> complaining - I figured it would fill the rest of the space with
>> zeros?).
>
> Well, sorta. :-)
>
> The * indicates a data range, (eg, 0:sizeOfX-1). Your
> data is, occasionally, smaller than that. And the array
> on the left hand size will have to equal the size of the
> array on the right hand side, or IDL will complain like
> this.
>
> There is a trick, though. If you specified only the
> *first* value of the data range, IDL will try to fit
> your array into the larger "space" on the left hand side.
> Try this:
>
> data[0,0,I] = framearray
>
> I think there is a good chance you will get away with that. :-)
>
> 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.")
Hi David,
Thanks for the swift response!
I've just tried that, and it fails with the message:
% Attempt to subscript DATA with I is out of range.
a quick print of framearray and data reveal that 'framearray' contains
the values of the 125th file, but 'data' is full of zeros.
Not quite sure what it's complaint means...
|
|
|