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 #65145 is a reply to message #65127] Thu, 12 February 2009 12:19 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:

> I have a file with 5 columns that looks like this (except for the
> column labels):
>
>
[/color]
[color=blue]>  T/F	I/U	Time	   Blocks	Volume[/color]
[color=blue]>  T	I	7.12	        227	11145.6[/color]
[color=blue]>  F	U	16.34	227	10914.9[/color]
[color=blue]>  T	I	21.43	232	11151.9[/color]
[color=blue]>  T	U	25.99	224	11364.1[/color]
[color=blue]>  F	I	37.13	199	7566.9[/color]
[color=blue]>  
[/color]
>
> Essentially I want to calculate the median for each time, blocks, and
> volume for the entire file, and then depending on T/F and I/U.
>
> I've gotten the script to work with the first three columns, but when
> I add the last two columns (blocks and volume) it returns an error.
> Can anyone tell me what I am doing wrong?


On this line:

readf,68, data, x1i, x2i, xxi, x3i, x4i, format='(2A2, G7.2)'

You are asking IDL to read five things, but you only
told it how to read three of them. When it reads the
first three, it then thinks, "Well, he didn't tell me anything,
so I'll try to use the format statement over again." Thus,
it tries to read a string, but it finds a float.

So, you have to fix your format statement. And I would be
careful of this, because even though you said it worked when
you had three variables rather than 5, that seems doubtful to
me. Make sure you can read the first line properly, then you will
be good to go.

Cheers,

David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (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: Sat Oct 11 19:05:35 PDT 2025

Total time taken to generate the page: 1.11709 seconds