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

Home » Public Forums » archive » Re: readf,1,format= ......
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: readf,1,format= ...... [message #57387] Sat, 08 December 2007 14:01 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
woopik@interia.pl writes:

> i have a question
> i have in a txt file some data
> 48883 149.55579541 12.44483936
> .... .... ....
> when i read a entire line
> line=''
> readf,1,line
> print,line
> i get a good output
> 48883 149.55579541 12.44483936
>
> but when i read data like this
> ttab = MAKE_ARRAY(nlines,3,/DOUBLE)
> ...
> FMTp='(I5,2X,D13.8,2X,D13.8)'
> for i=1,nlines do begin
> READF,1,FORMAT=FMT,l1,l2,l3
> ttab[i-1,0]=l1 & ttab[i-1,1]=l2 & ttab[i-1,2]=l3
> endfor
> and i print them
> print,FORMAT=FMTp,ttab[0,0], ttab[0,1],ttab[0,2]
> i get
> 48883 149.55580139 12.44483948
> and this is not the same it should be
> 48883 149.55579541 12.44483936
>
> why ?

Well, if this code is correct, I would say because you didn't
use the same format on your READF command as you did on your
PRINT command. So, I think the numbers were read in as floats,
not doubles. If I use the same format both places, no worries. :-)

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.")
Re: readf,1,format= ...... [message #57476 is a reply to message #57387] Sun, 09 December 2007 02:31 Go to previous message
woopik is currently offline  woopik
Messages: 18
Registered: September 2007
Junior Member
> I would say because you didn't use the same format on your
> READF command as you did on your PRINT command.

i dont understand your tip :(
i am using the same FMTp format for both

Wojtek
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: help with reading unsigned 16-bit integers
Next Topic: Help with iSurface colors

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

Current Time: Wed Oct 08 19:57:16 PDT 2025

Total time taken to generate the page: 0.00539 seconds