%% Convert Scalar Structure to Table
% Convert a scalar structure to a table using the default options.
% Create a structure array, S.

S.Name = {'CLARK';'BROWN';'MARTIN'};
S.Gender = {'M';'F';'M'};
S.SystolicBP = [124;122;130];
S.DiastolicBP = [93;80;92];

S

% The scalar structure, S, has four fields, each with three rows.
%
% Convert the structure array to a table.

T = struct2table(S)

% The structure field names in S become the variable names in the output table. The size of T is 3-by-4.
%
% Change Name from a variable to row names by modifying the table property, T.Properties.RowNames, and then deleting the variable Name.

T.Properties.RowNames = T.Name;
T.Name = [];

T

% Copyright 2012 The MathWorks, Inc.