Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array [message #65185 is a reply to message #65179] |
Mon, 16 February 2009 12:06   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
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.")
|
|
|