A very simple FORMAT question [message #39123] |
Wed, 21 April 2004 14:58 |
Andry William (Please
Messages: 11 Registered: March 2004
|
Junior Member |
|
|
Hi all,
Sorry for this very simple question but I would appreciate if
someone can help in the use of FORMAT in READF command.
Here is the simple data:
------------------------ test.datos ----------------------------
|020922 10:00:00 | 339| 348| 63| 356| 400| 88|
|020922 10:00:00 | 339| 348| 63| 356| 400| 88|
|020922 11:00:00 | 345| 349| 111| 422| 482| 140|
|020922 12:00:00 | 339| 340| 113| 431| 533| 137|
|020922 13:00:00 | 335| 333| 99| 410| 492| 127|
------------------------ End data ------------------------------
Here is the simple program to read it.
------------------------- Simple IDL program -------------------
flnm= 'test.datos'
SPAWN, "wc -l "+ flnm+ " | awk '{print $1}'", lineas
; This can be done in IDL without any problem
lineas= LONG(lineas[0])
data= INTARR(11, lineas)
OPENR, 1, flnm
READF, 1, data, format= '(1x,i6,3(1x,i2),4x,7(1x,i6))'
CLOSE,1
END
--------------------- End IDL program -------------------------
For some reason (I don't understand why) the READF command
reaches the end of the file and can not close it. The variable
"data" contains the following (not correct) values:
IDL> print, data
20922 10 0 0 339 348 63 356 400 88 544
20922 11 0 345 349 111 422 20922 12 0 339
340 113 431 20922 13 0 335 333 99 410 0
0 0 0 0 0 0 0 0 0 0 0
First, I am missing the second "0" value at the second line, and so
on. Any suggestion on what I am doing wrong in the formatted
reading?
Thanks for any help,
Andry
|
|
|