Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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

This question already has an answer here:

I have a set of arrays I would like to output to some file ArrayStorage.txt s.t. these arrays could be read-in to a separate notebook on a separate kernel. Is there an easy way to export a set of arrays?

share|improve this question

marked as duplicate by Mr.Wizard Mar 15 '13 at 2:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

"Is there an easy way to export a set of arrays" — the question seems to imply that existing methods are difficult. Have you tried looking in the help center? (press F1) – R. M. Mar 14 '13 at 23:42
@rm-rf Exporting a single array looks pretty simple, but I'm asking about exporting and importing a list of arrays? – FaintingWater Mar 14 '13 at 23:44
@FaintingWater A list of arrays is just a tensor of a higher rank. The question is: For which application do you want to export it? – halirutan Mar 14 '13 at 23:48
@halirutan For Mathematica. I would like a single file where I can reload all of my variables from another notebook after quitting the kernel? – FaintingWater Mar 14 '13 at 23:57
Then DumpSave is worth a look. You find it e.g. here in this question – halirutan Mar 15 '13 at 0:01

If you want to save definitions, then DumpSave is one way to go:

a = RandomReal[1, 1000];
b = RandomInteger[10, 10000];
c = {blub, boing, ups};

DumpSave["tmp/", {a, b, c}];

Now you can quit the kernel or restart Mathematica and with

<< "tmp/"

a, b and c have their old values again.

One thing you should note is that files written by DumpSave can only be read on the same type of computer system on which they were written.

share|improve this answer
Always worth noting DumpSave is platform specific. – kale Mar 15 '13 at 1:09
@kale I added this information. Thanks. – halirutan Mar 15 '13 at 1:43
+1, by the way... – kale Mar 15 '13 at 15:00

Another way was suggested by David Bailey on MathGroup late last year (!searchin/comp.soft-sys.math.mathematica/david$20bailey%7Csort:date/comp.soft-sys.math.mathematica/lf-EJeiqDwY/eEF29xJUFZwJ).

Briefly, as an alternative to MX files, try


to save, and


to read.

share|improve this answer

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