Function toMatrixString