Re: read a file written in fortran [message #71181] |
Mon, 07 June 2010 13:20  |
Thibault Garel
Messages: 55 Registered: October 2009
|
Member |
|
|
>
> You are telling IDL to read just one 14-digit float, followed by one
> character. That will be the first number, followed by the "0" that
> happens to be the character at position 15. That in itself would not
> cause that error, though presumably is not what you want, since the
> logical variable is printed at the end of the line. Do you want to
> read all 9 numbers, plus the logical value, or just one, skip the
> middle columns, then the logical value?
>
> I am guessing you read statement is in some loop, so that it kept
> trying to read, and reached the end of the file. If you show it, it
> may become clear why this is failing.
What i do in fact is:
readf,11,format='(9e14.6,A1)', a,b,c,d,e,f,g,h,i,my_logical
where a,b,c.... are initialized to 0.0d0
|
|
|
Re: read a file written in fortran [message #71182 is a reply to message #71181] |
Mon, 07 June 2010 12:54   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jun 7, 4:42 pm, bing999 <thibaultga...@gmail.com> wrote:
> It contains rows all equivalent to the one below:
>
> 0.207720E-03 0.245036E+02 0.497323E+01 0.116080E+22 0.156774E+01
> 0.615295E-04 0.893258E-06 0.100000E+01 0.145065E-01T
You are telling IDL to read just one 14-digit float, followed by one
character. That will be the first number, followed by the "0" that
happens to be the character at position 15. That in itself would not
cause that error, though presumably is not what you want, since the
logical variable is printed at the end of the line. Do you want to
read all 9 numbers, plus the logical value, or just one, skip the
middle columns, then the logical value?
I am guessing you read statement is in some loop, so that it kept
trying to read, and reached the end of the file. If you show it, it
may become clear why this is failing.
|
|
|
|
|
Re: read a file written in fortran [message #71316 is a reply to message #71181] |
Tue, 08 June 2010 02:31  |
Thibault Garel
Messages: 55 Registered: October 2009
|
Member |
|
|
For information, here is how i wrote the file in fortran:
write(my_unit,'(9e14.6,L1)') a,b,c,d,e,f,g,h,i,my_logical
Then, how to read a L1 format in IDL?
thanks
|
|
|