Q: About reading files into an array without knowing the size. [message #5205] |
Thu, 02 November 1995 00:00  |
David van Kuijk
Messages: 3 Registered: November 1995
|
Junior Member |
|
|
Hi
One of the nice things of IDL is that it is possible to read whole
ASCII-files of data (e.g. floats) into an array in one swoop, without
having to go through a while loop which reads all of these numbers one by
one. E.g.:
OPENR,1, "filename"
floatss=FLTARR(10000)
READF, 1, floatss
What is not so nice is that IDL has to know exactly how many datapoints
there are in the file, otherwise not all the data are read, or you get
sth like an "End of file encountered"-error. So the size of _floatss_ in
the example above should be equal to the number of floats in the file.
I know that Mathlab is capable of processing files with an unknown number
of data.
Does anybody know a way to achieve this in IDL (maybe I missed something)?
David,
************************************************************ ***********
* David van Kuijk | Max-Planck-Institute for Psycholinguistics *
* E-mail: kuijk@mpi.nl | Wundtlaan 1 *
* | 6525 XD Nijmegen *
* | The Netherlands *
* Tel: +31 (0)24 3521523 | *
* Fax: +31 (0)24 3521213 | Snail-mail: P.O. Box 310, 6500 AH Nijmegen *
* "Prots the whoblem?" *
************************************************************ ***********
|
|
|