Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array [message #65207 is a reply to message #65206] |
Sun, 15 February 2009 11:44   |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Feb 15, 7:35 pm, polystethylene <polystethyl...@hotmail.com> wrote:
> On Feb 15, 7:05 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> polystethylene writes:
>>> 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...
>
>> Whoops! Didn't notice your loop variables before.
>> IDL is a zero indexed language. You loops will
>> have to go from 0 to n-1, not from 1 to n.
>
>> I think this might be what the error is about.
>> I think I=125 is out of bounds of your last array
>> dimension, which should go from 0 to 124.
>
>> 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.")
>
> Ah yes of course. I know that as well, that's just me being stupid.
> Actually, looking at it, I know why I set the loop from 1 to 125: I
> make use of the loop index to open each file.
>
> If I change the loop counter to 0,124, it tries to open file 000.dump,
> which doesn't exist. Is there anyway to specify i+1 in my second line?
>
> Thanks David
Nevermind, i was stupidly trying to put the +1 on the format specifier
(getting mixed up between i for integer and i the index)
Thanks for all your help David, it appears to be working now.
p.s. When's the 3rd edition of your book due, is it imminent enough
that I should hold out on buying the 2nd edition?
|
|
|