Note that the fprintfMat given above can be shortened
by the use of varargopt and the (:) operator for hash table.
function fprintfMat(filename,mat,varargopt)
// nsp shortcut for scilab fprintfMat
F = fopen(filename, mode="w")
F.put_matrix[mat,varargopt(:)]
F.close[]
endfunction
Note also that the advantage of a manual use of put_ and get_matrix
is
the fact that you can store as many matrices you need in a file.
n=50;
a=rand(n,n,'u');
n=23;
b=rand(n,n,'u');
fd=fopen('TMPDIR/Mat',mode='w');
fprintf(fd,'Some text for a \n',);
fd.put_matrix[a]
fprintf(fd,'Some text for b \n',);
fd.put_matrix[b]
fd.close[];
fd=fopen('TMPDIR/Mat',mode='r');
[a1,txta1]=fd.get_matrix[];
[b1,txtb1]=fd.get_matrix[];
fd.close[];
if max(a1-a) > 1.e-1 then pause,end
if max(b1-b) > 1.e-1 then pause,end
jpc