PsiLAB Help Manual
Page
Section:
High level matrix functions
Name:
read_fmat
Read a float matrix in fortran format from a file.
This function reads a float vector or matrix (2 dim) from a file in fortran format. Either the target matrix is allocated automatically with sizes determined by the file header (first line), or an already allocated matrix can be provided with the mat argument. The header in the file is necessary in the first case, optional in the second case.
[ ?mat:(float, 'a, 'b) Matrix.t ] =
read_fmat
file:string
?mat:(float, 'a, 'b) Matrix.t list
?header:bool
()
The header can be discarded if the header argument is set to false.
Example:
[] let f = fmatrix ~dim:[5;3] ~rand:[1.0] () ;;
[] write_fmat "test.dat" f () ;;
[] let fr = read_fmat "test.dat" () ;;
Printed by PsiLAB