table

Methods

Method Reference: table.summary

table: summary (tbl)
table: s = summary (tbl)

Print a summary of a table.

summary (tbl) prints the description from tbl.Properties.Description followed by a summary of each table variable’s values and their properties as defined in tbl.Properties.VariableUnits and tbl.Properties.VariableDescriptions.

s = summary (tbl) returns a structure, s, that contains a summary of the input table, tbl. Each field of s is a structure that summarizes the values in the corresponding variable of tbl. Where applicable, the number of missing values is reported in a NumMissing field and printed when it is greater than zero.

  • For numerical variables of double, single or any int type, it prints the minimum, median, and maximum values. For multicolumnar numerical variables it prints the minimum, median, and maximum values for each column separately.
  • For variables of logical type, it prints the occurrences of True and False.
  • For variables of type datetime and duration it prints the minimum, median, and maximum values, computed after excluding any missing (NaT or NaN) elements.
  • For variables of type calendarDuration, which are not totally ordered, only the size, the type, and the number of missing values are reported.
  • For variables of type cellstr, cell, string, categorical, and struct it prints the size and the type of variable.

Source Code: table

Create a Table from patient data

 load patients
 BloodPressure = [Systolic Diastolic];
 T = table (Gender, Age, Smoker, BloodPressure, 'RowNames', LastName);

Add descriptions and units to table

 T.Properties.Description = 'Simulated patient data';
 T.Properties.VariableUnits = {'', 'Yrs', '', 'mm Hg'};
 T.Properties.VariableDescriptions(4) = {'Systolic/Diastolic'};

Print a summary of the table

 summary (T)
T: 100x4 table
Description: Simulated patient data
Variables:
    Gender: cell array of character vectors
    Age: double (Yrs)
    Smoker: logical (34 true)
    BloodPressure: 2-column double (mm Hg, Systolic/Diastolic)
Statistics for applicable variables:
                          NumMissing        Min        Median         Max          Mean           Std
    Gender                    0
    Age                       0              25             39         50         38.2800        7.2154
    BloodPressure(:,1)        0             109            122        138        122.7800        6.7128
    BloodPressure(:,2)        0              68        81.5000         99         82.9600        6.9325