# How to save all variables in the workspace into a file? [duplicate]

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)

• Have a look at DumpSave... in fact, this looks like a duplicate of Saving Mathematica kernel state? – Yves Klett Dec 9 '13 at 8:40
• Thank you! That is the answer! Can I reuse the .mx file in C++ or any other programming language? – LCFactorization Dec 9 '13 at 8:46
• Quite probably not (easily)... but you could post another question on this, perhaps someone can answer with authority. – Yves Klett Dec 9 '13 at 8:49
• 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. – Yves Klett Dec 9 '13 at 9:56
• thank you very much! it is very nice of you! – LCFactorization Dec 9 '13 at 11:38