%% Save Structure Fields as Individual Variables
% Create a structure, s1, that contains three fields, a, b, and c.

s1.a = 12.7;
s1.b = {'abc',[4 5; 6 7]};
s1.c = 'Hello!';

%
% Save the fields of structure s1 as individual variables in a file called newstruct.mat.

save('newstruct.mat','-struct','s1');

%
% Check the contents of the file using the whos function.

disp('Contents of newstruct.mat:')
whos('-file','newstruct.mat')

% Copyright 2015 The MathWorks, Inc.