| Re: Reading large Ascii files [message #27638 is a reply to message #27634] |
Tue, 30 October 2001 07:01  |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
Isa,
I cant reproduce your problem,
here is the output I get from the code below which does outpur/input of
12500 floats in one line
print, !version
{ x86 Win32 Windows Microsoft Windows 5.5 Beta Jun 20 2001 32 64}
IDL> ascii_io_large_test
values read incorrectly = 0
line length read = 100000
regards
Martin
=================================
pro ascii_io_large_test
fn = !fpaths.tmp + "aio_test.txt"
; create output
a = findgen(12500)/1000
; write test file
openw, lun, fn, /get_lun, width = 500000L
; write two lines worth
printf, lun, a,format='(12500F8.3)'
printf, lun, a, format='(12500F8.3)'
close, lun
; define input variables
b= fltarr(12500)
line = ""
; read test file
openr, lun, fn, /get_lun;, width = 10000L
readf,lun,format='(12500F8.3)',b
readf,lun,line
close , lun
; analyse data
ids = where(a ne b, count)
print, "values read incorrectly =", count
print,"line length read =", strlen(line)
end
=================================
--
----------------------------------------
Martin Downing,
Clinical Research Physicist,
Grampian Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
"Isa Usman" <I.Usman@rl.ac.uk> wrote in message
news:9rma6a$gbk@newton.cc.rl.ac.uk...
> Hello,
>
> I am trying to read a single row from a large file. The amout of numbers
per
> row is about 12500. So in IDL i have the following lines;
>
> readf,lun,format='(500F8.3)',ch1_val_s
>
> so that i only read 500 values at a time and it gives me the error;
>
> % Input line is too long for input buffer of 32767 characters.
>
> From what i can gather, IDL is trying to read the whole line first before
it
> puts it into the array. Can anybody suggest a way round this please.
>
> Thanks
>
> Isa Usman
>
>
>
|
|
|
|