I did some time consuming computation and obtained a lot of arrays and variables; however after restart the Mathematica Kernel, all these computational results disappeared.

How can I save all these workspace variables into some file, and then re-use them by loading the file next time when I restart Mathematica?

(In Matlab all the current workspace can be saved into an *.mat file by save, and re-used by load)

  • 5
    $\begingroup$ Have a look at DumpSave... in fact, this looks like a duplicate of Saving Mathematica kernel state? $\endgroup$ – Yves Klett Dec 9 '13 at 8:40
  • $\begingroup$ Thank you! That is the answer! Can I reuse the .mx file in C++ or any other programming language? $\endgroup$ – LCFactorization Dec 9 '13 at 8:46
  • 1
    $\begingroup$ Quite probably not (easily)... but you could post another question on this, perhaps someone can answer with authority. $\endgroup$ – Yves Klett Dec 9 '13 at 8:49
  • 5
    $\begingroup$ Glad to be of help! Since there is already a good answer in the linked question (see my first comment), I will refrain from repeating that - please upvote the linked Q&A instead. $\endgroup$ – Yves Klett Dec 9 '13 at 9:56
  • $\begingroup$ thank you very much! it is very nice of you! $\endgroup$ – LCFactorization Dec 9 '13 at 11:38