Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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 use this command from the Mathematica documentation center

Export["1.mat", {"t" -> {{1,2,3}},"u" -> {{4,5,6}}}, "LabeledData"]

to save data as mat file with two variables t and u, and it does not work. The file is empty! The command Export["1.mat",{{1,2,3}}] works fine. How to solve this problem? I'd like to save in single file plenty variables. I am using Mathematica 7.

share|improve this question
With version 9 it works correctly. I cannot test with version 7. – Szabolcs Apr 8 '13 at 18:33
If you don't have access to any more recent versions of Mathematica, and v7 won't export correctly, you can try using some Mathematica-MATLAB interface (e.g. here) to transfer the data. – Szabolcs Apr 8 '13 at 18:36
Thank you, I'll try to install M9. – nail Apr 8 '13 at 18:51

I think you can only export data in the form of matrices in version 7. If you want to store multiple pieces of data x and y, you can do something like this:

x = {1, 2, 3};
y = {4, 5, 6, 7, 8};
z = PadRight[{x, y}];
Export["testz.mat", z]

In Matlab, you will have one thing, called "Expression1" that consists of the matrix z. You will have to unpack it yourself over in Matlab to use x and y separately again.

share|improve this answer
Are you a MATLAB user too? – Szabolcs Apr 8 '13 at 18:52
Matlab is my native tongue... – bill s Apr 8 '13 at 19:02
Szabolcs -- I just saw your post about mEngine… -- I had no idea that such a thing existed. It sounds like a great resource... – bill s Apr 8 '13 at 19:06

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.