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

Home » Public Forums » archive » Re: A very simple FORMAT question
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: A very simple FORMAT question [message #39111 is a reply to message #39092] Thu, 22 April 2004 02:06 Go to previous messageGo to previous message
Chris Lee is currently offline  Chris Lee
Messages: 101
Registered: August 2003
Senior Member
In article <4086EE70.9070707@ya.com.spam>, "Unknown" <andry@ya.com.spam>
wrote:

> Hi all,
> ------------------------ test.datos ----------------------------
> |020922 10:00:00 | 339| 348| 63| 356| 400| 88|
> |020922 10:00:00 | 339| 348| 63| 356| 400| 88|
> -----------------
> SPAWN, "wc -l "+ flnm+ " | awk '{print $1}'", lineas
> ...
> READF, 1, data, format= '(1x,i6,3(1x,i2),4x,7(1x,i6))'

Hi,

The line counting line confused me, I use a function called FILE_LINES
(I'm not sure if it's local or not, it appears to be undocumented if it's
a library function).

As for the formatting, it works fine for single line reads. So you can
either read one line at a time or use STRSPLIT on each line (which can
then be read in all at once)
e.g.
flnm= 'test.datos'
n_data=10
n_lines=file_lines(flnm)
d=strARR(n_lines)
data=intarr(n_data,n_lines)

OPENR, 1, flnm
readf,1,d
CLOSE,1

for i=0, n_lines-1 do $
data[*,i]= fix(strsplit(d[i],'[ :|]',/regex,/ex))

I don't know why the FORMAT is broken, only that READF seems to lose its
position in the file and applies the format to the wrong string.

The 'missing second zero' is actually the first zero (the minutes in the time
string), which is being used as the the third dummy argument in the
format string. After that, everything blows up.

Chris.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: simplify a polyline?
Next Topic: Newbie needs help getting mpi_plot going

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

Current Time: Fri Oct 10 15:16:22 PDT 2025

Total time taken to generate the page: 1.44071 seconds