Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array [message #65179 is a reply to message #65175] |
Mon, 16 February 2009 16:13   |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Feb 16, 8:06 pm, David Fanning <n...@dfanning.com> wrote:
> Spon writes:
>> you need to stick this line:
>> data =3D fltarr(10,nstar,nfiles)
>
>> outside your FOR loop, so you don't keep re-defining it (full of
>> zeroes) at every iteration.
>
> Stefan, it is hard for me to know if the code
> you posted is the actual code you use, but if it
> is, I remind you that many of these kinds of errors
> can be fixed, or at least spotted a hell of a lot
> easier, if the code has a bit of "style" to it.
> In this case, I am talking about indenting the
> contents of loops.
>
> Some people think style is a matter of an anal
> personality run amuck. And I suppose it sometimes is.
> But it is also a way of organizing your thoughts on
> paper (or computer screen, as the case may be), and
> as such it can be an enormous help writing something
> as literal as instructions to a computer.
>
> Just thought I would mention it. :-)
>
> Cheers,
>
> David
>
> P.S. You can find many styles by reading the code
> of any IDL library. In fact, you will sometimes be able
> to date the code by the style in current use. *Which* style
> to choose is almost irrelevant. Any style used consistently
> will work for the purpose.
>
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks David, duly noted. I've been trying to improve my formatting
(and making my programs more modular) - indenting the loop contents is
a good tip, I have adapted the code and it's definitely nicer to read.
|
|
|