%% Convert Column Headings to Variable Names
% Convert a cell array to a table, and then include the first row from the cell array as variable names for the table.
% Create a cell array where the first row contains character vectors to identify column headings.

Patients = {'Gender' 'Age' 'Height' 'Weight' 'Smoker';...
    'M' 38 71 176 true;...
    'M' 43 69 163 false;...
    'M' 38 64 131 false;...
    'F' 38 64 131 false;...
    'F' 40 67 133 false;...
    'F' 49 64 119 false}

%
% Exclude the columns headings and convert the contents of the cell array to a table.

C = Patients(2:end,:);
T = cell2table(C)

% The table, T, has variable names C1,...,C5.
%
% Change the variable names by setting the table property, T.Properties.VariableNames, to the first row of the cell array.

T.Properties.VariableNames = Patients(1,:)

% Copyright 2012 The MathWorks, Inc.