matrix_writefile