Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array [message #65211] |
Sun, 15 February 2009 10:27 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
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.")
|
|
|