I am trying to import data from a saved MATLAB struct array, but it seems that Mathematica is only importing the first element.
MATLAB
blank = struct('x', [], 'y', [], 'z', []);
data = repmat(blank, 1, 10);
for i = 1:10
data(i) = struct('x', i, 'y', i * 2, 'z', i * 3);
end
save('test.mat', 'data');
Mathematica
In[76]:= Import["test.mat", "LabeledData"]
Out[76]= {"data" -> {"x" -> {{1.}}, "y" -> {{2.}}, "z" -> {{3.}}}}
Does anyone know why this is happening?
As a temporary fix, I've simply resorted to storing multiple struct's in a cell array, i.e.
data{i} = struct(...)
Mathematica seems to be able to handle that fine.