<< mmread MatrixMarket

MatrixMarket >> MatrixMarket > mmwrite

mmwrite

Writes a sparse or dense matrix to a Matrix Market file

Calling Sequence

mmwrite(filename, A )
mmwrite(filename, A , comment )
mmwrite(filename, A , comment , field )
mmwrite(filename, A , comment , field , precision )

Parameters

filename

a 1-by-1 matrix of strings, path of the Matrix Market file.

A

a matrix of type 1 (real or complex matrix), 4 (boolean matrix), 5 (sparse matrix) or 6 (sparse boolean matrix).

comment

a 1-by-n matrix of strings, contains the comments to write in the file header (default comment = []). If ommitted, or if equal to the empty matrix, a single line date stamp comment will be included.

field

a 1-by-1 matrix of strings, with values "real", "complex" or "pattern" (default field = "default") If equal to "default", data will determine type.

precision

a 1-by-1 real matrix, the number of digits to display for real or complex values (default precision=16).

Description

Writes a sparse or dense matrix to a Matrix Market file. Scilab sparse boolean matrices are stored with "pattern" data field type.

Examples

filename = fullfile(TMPDIR,"A.mtx");
A=matrix(1:12,3,4);
mmwrite(filename,A); 
edit(filename)
//
filename = fullfile(TMPDIR,"A.mtx");
A=sparse(matrix([0,0,3,4,0,0,0,8,9,0,11,0],3,4));
A=A'*A
mmwrite(filename,A,["Test mmwrite";"Generated by Scilab"]) ; 
edit(filename)

See Also

Authors

Copyright (C) 2009 - INRIA - Serge Steer

Copyright (C) 2011 - Benoit Goepfert

Copyright (C) 2011 - DIGITEO - Michael Baudin

Bibliography

http://math.nist.gov/MatrixMarket/formats.html

http://math.nist.gov/MatrixMarket/mmio/matlab/mmwrite.m


Report an issue
<< mmread MatrixMarket