Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to export a matrix in a file using Mathematica. I get the matrix and then use

Export["myfile.dat", MyMatrix, "???Format???"]

There are many formats. I want the one that prints the matrix in this way:


That is the classic Mathematica format....

How can I do this? Which one is the correct format?

share|cite|improve this question

Export["file.txt",MyMatrix,"String"] works in Mathematica 6

share|cite|improve this answer

In really you can do this just with Put:

a = Table[RandomInteger[], {10}, {10}];
a >> "C:\\test.txt"
share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.