Reading MatrixMarket files into MATLAB - iteloo/formality-tools GitHub Wiki

A MATLAB routine that imports a matrix in the .mtx format can be found here.

Simply put mmread.m in your working directory and call A = mmread('A.mtx') in your MATLAB code to import A.mtx into the variable A.

Importing integer-valued matrices

To import integer-valued matrices, you need to modify mmread.m to handle the integer case by running

sed -i -e "s/\(strcmp(field,'real')\)/\1 || strcmp(field,'integer')/" mmread.m