MATLAB: Save Struct as .mat file!!!

.mat filesavestructures

Hello all,
I have a problem in saving Struct format in .mat file.
If I have "a" as 1×5 struct
So, in command window it looks like this:
a =
ans =
246
ans =
444
ans =
630
ans =
810
ans =
984
Any way that I can save it as a .mat file of 1x5?
Thanks so much for your help :)

Best Answer

Of course this does not work, because "a.latency" is not a name of a variable. You need:
save('filename.mat', 'a')
The functional form is less confusing for the save command.
If you want to save the fields "latency" only:
latency = {a.latency};
save('filename.mat', 'latency')