Read matrix from a file
readmatrix name
Reads in and returns a matrix (2D array of numbers) from a file with the specified name. Each line in
the file becomes a matrix row. Lines should be composed of numbers (separated with white spaces then) Empty lines
are omitted.
If the name does not contain an absolute path then the file is assumed to be in the current directory,
specified with the :pool_cfg,"current_dir
variable.
The name can be also a http adress.
Example:
"a := {{1 2 3 4} {5 6 7 8}}
writedata :a "matrix.txt
"b := readmatrix "matrix.txt
print :b
Output:
{{1 2 3 4} {5 6 7 8}}
See also:
Table of Content