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

Home » Public Forums » archive » Re: Skipping a line while reading a file.
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: Skipping a line while reading a file. [message #15545] Fri, 21 May 1999 00:00
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
DBorland wrote:
>
> Greetings,
> I am trying to read in some data from a file, and there is a blank line in
> the file. This would not be a problem if the next line I needed to read was
> not a string. Is there any way to have idl skip a line while reading a
> file?
> Here is an example of the data file:
> [... snipped]

> and I am reading it in with the following:
> for i = 0, n-1 do begin
> readf,lun,index,hex_address,angle,magnitude,potential,area
> readf,lun,location
> readf,lun,outward_normal
> readf,lun,address
> : : :
> endfor
>
apparently you don't assign any variable type before you read them. This
can cause all sorts of trouble. As David suggested, you can (only !)
read a string variable if you let IDL know beforehand that it has to
expect a string:
line = ''
readf,lun,line
Careful also with long integers! It never hurts to write
number = 0L
readf,lun,number


... maybe IDL should have an IMPLICIT NONE option ??

Regards,
Martin


--

|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
Re: Skipping a line while reading a file. [message #15557 is a reply to message #15545] Thu, 20 May 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
David Borland (dborland@egi.com) writes:

> Is there any way to have idl skip a line while reading a
> file?

blank_line = ""
ReadF, lun, blank_line

To skip three lines, for example:

blank_lines = StrArr(3)
Readf, lun, blank_lines

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 3D Puzzle
Next Topic: Help

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

Current Time: Sat Oct 11 08:41:41 PDT 2025

Total time taken to generate the page: 0.48217 seconds