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

Example: 1

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)
Description:  Simulated patient data

Variables:

    Gender: 100x1 cell

    Age: 100x1 double

        Properties:
            Units: Yrs
        Values:
            Min       25
            Median    39
            Max       50

    Smoker: 100x1 logical

        Values:
            True      34
            False     66

    BloodPressure: 100x2 double

        Properties:
            Units: mm Hg
            Description: Systolic/Diastolic
        Values:
                      Column 1    Column 2    
                      ________    ________    
            Min            109          68    
            Median         122        81.5    
            Max            138          99