Delimited Reading
dlm-read
1 Examples
6.12

Delimited Reading

Leif Andersen

 (require dlm-read) package: dlm-read

The goal of dlm-read is to provide functionality similar to dlmread in Matlab/Octave.

WARNING! this library is unstable. The actual results of dlm-read may change, however the result will remain something easily to plot.

procedure

(dlm-read [file delimiter])  (listof (listof number?))

  file : (or/c port? path-string?) = (current-input-port)
  delimiter : char? = #\tab
Parsed delimited data into a matrix ready for plotting.

file is the input file or port containing the data.

delimiter is the character used to delimit the data.

1 Examples

Here is an example matrix in text (separated by tags):

"simple.tab"

1       2

3       4

To parse this data:
> (require dlm-read)
> (dlm-read "examples/simple.tab")

'((1 3) (2 4))

Alternatively, a port can be used:

> (require dlm-read
           racket/port)
> (with-input-from-string "1\t2\n3\t4"
   (lambda () (dlm-read)))

'((1 3) (2 4))