How to save array of structures in .mat file in Matlab? Is it possible?
p(1).x=0;
p(1).y=0;
p(2).x=1;
p(2).y=1;
save('matfilename','-struct','p');
% ??? Error using ==> save
% The argument to -STRUCT must be the name of a scalar structure variable.
You can use
savewithout the-structparameter:If you want want to store
xandyas separate arrays (as-storewould ifpwas a scalar struct) then you’ll need to do it yourself (you can use thefieldnamesfunction to collect the names of all fields in a struct).