%% Convert Table to Structure Array
% Create a table, T, with five rows and three variables.

T = table(categorical({'M';'M';'F';'F';'F'}),[38;43;38;40;49],...
    [124 93;109 77; 125 83; 117 75; 122 80],...
    'VariableNames',{'Gender' 'Age' 'BloodPressure'})

%
% Convert T to a structure array.

S = table2struct(T)

% The structure is 5-by-1, corresponding to the five rows of the table, T. The three fields of S correspond to the three variables from T.
%
% Display the field data for the first element of S.

S(1)

% The information corresponds to the first row of the table.
% Copyright 2012 The MathWorks, Inc.