## how to read and write a matrix in numpy

August 1st, 2007 by Lawrence David

to write out a matrix from python’s numpy:

import numpy

numpy.savetxt(matrix_filename,matrix_object)

to read a matrix from numpy:

import numpy

matrix_object = numpy.genfromtxt(matrix_filename)