File: writematrix.m

package info (click to toggle)
combblas 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 190,476 kB
  • sloc: cpp: 55,912; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (16 lines) | stat: -rw-r--r-- 341 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function writematrix(A,name,isint)

[i,j,k] = find(A);
fid = fopen(name, 'w+');
fprintf(fid, '%d\t%d\t%d\n',size(A,1), size(A,2), nnz(A)); 
if(isint)
    for m = 1:nnz(A)
        fprintf(fid, '%d\t%d\t%d\n',i(m),j(m),k(m)); 
    end
else
    for m = 1:nnz(A)
        fprintf(fid, '%d\t%d\t%.6f\n',i(m),j(m),k(m)); 
    end
end
fclose(fid);