comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: idl readf error
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: idl readf error [message #65122 is a reply to message #65121] Fri, 13 February 2009 20:17 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rollo.tomasi@hotmail.com writes:

> Here's what I have:
>
> IDL> openr, 1, 'file1.out'
> IDL> h = strarr(5)
> IDL> readf, 1, h
> IDL> close, 1
> IDL> for j=0,4 do print, h[j]
> T U 17.81 201 145225.9
> T U 37.67 191 98975.8
> T U 21.77 201 129774.9
> T I 0.65 1 69.5
> T I 0.36 1 69.3
>
> By doing this I noticed that the values in the last column get pretty
> large, so I changed the format to
> format='(2A2, G7.2, G7.2, G10.2)'
>
> And I still get the same error.
>
> The largest values in the numerical columns are:
> column 3: 272.23
> column 4: 1000
> column 5: 145225.9

OK, well, as I expected, that format does not correspond
to what is in the file. And I am still mystified as to
why it worked (if it did) initially. The format looks to
me to be something more like this:

format='(2(A1,7x),F5.2,3x,I3,5x,G8.2)'

Try that and see if you have better luck. :-)

Here is the code I used to read the first line:

IDL> openr, 1, file
IDL> a="" &b = "" & c=0.0 & d=8 & e=0.0
IDL> readf, 1, a, b, c, d, e, format='(2(A1,7x),F5.2,3x,I3,5x,G8.2)'
IDL> print, a, b, c, d, e
TU 37.6700 191 98975.8

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: happy 1234567890 day!
Next Topic: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Dec 03 13:56:40 PST 2025

Total time taken to generate the page: 2.08862 seconds