writes a matrix in a file
fprintfMat(file,M [,format,text])
:file a string, the pathname of the file to be written : :M a matrix of real numbers : :format a character string giving the format. This is an optional
parameter, the default value is “%lf”. Supported format: %[width].[precision]type or %type, where: width: an optional number that specifies the minimum number of characters output; precision: an optional number that specifies the maximum number of characters printed for all or part of the output field, or the minimum number of digits printed for integer values; type: lf, lg, d, i, e, f, g (see scanf_conversion for details).
:
The fprintfMat function writes a matrix in a formated file. Each row of the matrix give a line in the file. If text is given then the elements of text are inserted elementwise at the beginning of the file one element per line.
n = 50;
a = `rand`_(n, n, "u");
fprintfMat(TMPDIR + "/Mat", a, "%5.2f");
a1 = `fscanfMat`_(TMPDIR + "/Mat");
// Lets we create a file Mat1 and insert a comment into it
some_comment = ["This is a comment","This the second line of the comment.","This is the third line of the comment."];
fprintfMat(TMPDIR + "/Mat1", a, "%5.2f",some_comment);