Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I save a rational matrix for Mathematica and Matlab to read?

Hi,

I create a rational matrix (rather large, say 1000x1000), and I want to save it in a file that can be read by Mathematica or MATLAB (with symbolic toolbox). Is there a simple way to do that?

Right now, I use

o = open('file.txt','w')

o.write(str(A))

o.close()

where A is the matrix. However, it has these "[" and "]" at the beginning of line that makes it difficult for Mathetmatica and MATLAB to read. Any suggestions would be appreciated.