%% Specify Variable Names
% Create a table from arrays. To specify table variable names, use the 'VariableNames' name-value pair argument. For example, you can use 'VariableNames' to specify names when the other input arguments are not workspace variables.

T = table(categorical({'M';'F';'M'}),[45;32;34],...
          {'NY';'CA';'MA'},logical([1;0;0]),...
          'VariableNames',{'Gender','Age','State','Vote'})

%
% Create a table with the state names as row names. You can specify both the 'VariableNames' and 'RowNames' name-value pairs when using the table function.

T = table(categorical({'M';'F';'M'}),[45;32;34],logical([1;0;0]),...
          'VariableNames',{'Gender','Age','Vote'},...
          'RowNames',{'NY';'CA';'MA'})

% Copyright 2012 The MathWorks, Inc.