%% Access All Table Data as Matrix
% Access all the data from a table as a matrix, using the name of the second dimension of the table.
% Create a table that has five rows of data about a set of patients.

Age = [38;43;38;40;49];
Smoker = logical([1;0;1;0;1]);
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];

T = table(Age,Smoker,Height,Weight,BloodPressure)

%
% Display the names of the table dimensions using the DimensionNames property. The default name of the second dimension is Variables.

T.Properties.DimensionNames

%
% Access the table data as a matrix using the syntax T.Variables. This syntax is equivalent to accessing all the contents using curly brace syntax, T{:,:}. If the table data cannot be concatenated into a matrix, then an error message is raised.

T.Variables

%
% Rename the second dimension. If you change the name, then you can use the new name to access the data.

T.Properties.DimensionNames{2} = 'PatientData';
T.PatientData

%
% Copyright 2012 The MathWorks, Inc.