2

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.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
nail
  • 21
  • 1

1 Answers1

1

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.

bill s
  • 68,936
  • 4
  • 101
  • 191