timetable.summary
timetable: summary (tt)
timetable: s = summary (tt)
Summarise a timetable.
summary (tt) prints what the timetable holds: its size,
its description where it has one, the row times, the variables with
their types and any units and descriptions, and a table of statistics
for everything that has any.
s = summary (tt) returns that as a structure
instead, one field per variable and one for the row times, filed under
the row dimension’s name and coming first.
The row times report where they start, how fast they run and how far
apart they step, in StartTime, SampleRate and
TimeStep, alongside the statistics a datetime or
duration variable would report. They carry no description,
units or continuity, having none.
Which statistics a variable reports follows its type. Numeric,
datetime and duration variables report the count of
missing values, the smallest, the median, the largest, the mean and
the standard deviation; an integer reports no deviation and its median
rounds to its own type; an ordinal categorical is ordered but
has no mean; a plain one reports its categories and their counts; a
logical reports how many are true and false and appears in no
statistics; and everything else reports the count of missing values
alone. A variable of several columns reports one row per column.
See also: ismissing, timetable
Source Code: timetable
summary prints what a timetable holds: its size, its row times, its variables with their types, and a table of statistics for everything that has any. The row times come first, under the row dimension's name.
t0 = datetime (2024, 1, 1);
Depth = [12; 45; 23; 8];
Site = categorical ({'N'; 'S'; 'N'; 'S'});
TT = timetable (Depth, Site, 'RowTimes', t0 + hours (0:3)');
summary (TT)
TT: 4x2 timetable
Row Times:
Time: datetime
Variables:
Depth: double
Site: categorical (2 categories)
Statistics for applicable variables and row times:
NumMissing Min Median Max Mean Std
Time 0 01-Jan-2024 01-Jan-2024 01:30:00 01-Jan-2024 03:00:00 01-Jan-2024 01:30:00 01:17:27
Depth 0 8 17.5000 45 22 16.5932
Site 0
Ask for an output and the same thing comes back as a structure, one field per variable and one for the row times. Those report where the times start, how fast they run and how far apart they step.
t0 = datetime (2024, 1, 1);
TT = timetable ([12; 45; 23; 8], 'RowTimes', t0 + hours (0:3)', ...
'VariableNames', {'Depth'});
s = summary (TT);
fieldnames (s)
ans =
2x1 cell array
{'Time' }
{'Depth'}
s.Time.StartTime
ans = datetime 01-Jan-2024
s.Time.TimeStep
ans = duration 01:00:00
s.Depth.Mean
ans = 22
Which statistics a variable reports follows its type. An integer has no standard deviation and its median rounds to its own type; a logical reports how many are true and appears in no statistics at all.
t0 = datetime (2024, 1, 1);
TT = timetable (int8 ([1; 2; 3; 4]), logical ([1; 0; 1; 1]), ...
'RowTimes', t0 + hours (0:3)', ...
'VariableNames', {'Count', 'Flag'});
s = summary (TT);
fieldnames (s.Count)
ans =
10x1 cell array
{'Size' }
{'Type' }
{'Description'}
{'Units' }
{'Continuity' }
{'NumMissing' }
{'Min' }
{'Median' }
{'Max' }
{'Mean' }
s.Count.Median
ans = 3
fieldnames (s.Flag)
ans =
7x1 cell array
{'Size' }
{'Type' }
{'Description'}
{'Units' }
{'Continuity' }
{'True' }
{'False' }