summary
Summary of table or timeseries variables
Syntax
summary(t) summary(t, statistics) summary(t, statistics, datavars) S = summary(t, statistics, datavars)
Arguments
- t
table or timeseries object.
- statistics
string (optional). Specifies which statistics to compute. Possible values are:
"default" (default value): computes a standard set of statistics (NumMissing, Min, Median, Max, Mean, Std)"none": no statistics are computed"allstats": computes all available statistics
- datavars
string (optional). Names of variables to include in the summary. Default is "all", meaning all variables are summarized.
- S
A structure containing the summary information for each variable.
Description
The summary function displays or returns a structure containing a summary of the variables of
in a table or timeseries.
For each variable, summary reports:
Size and data type
Variable description and units (if available)
Statistical information depending on the variable type
If no output argument is specified, the summary is displayed in the console.
When an output argument is requested, summary returns a structure where each field corresponds to a variable name which contains a sub-structure with metadata (Size, Type, Description and Units) and statistics (depending on variable type).
For timeseries, row time information (start time, sample rate, time step) is also summarized.
Supported Statistics for Numeric Data
Depending on the selected options, the following statistics may be computed:
NumMissing: number of missing values (%nan or NaT)Min: minimum valueMax: maximum valueMedian: median valueMean: mean valueStd: standard deviationVar: varianceQ1: first quartile (25th percentile)Q3: third quartile (75th percentile)Mode: modeRange: range of valuesSum: sum of valuesNumUnique: number of unique non-missing valuesSum: number of non-zero values
Numeric types include: double, integer types, duration and datetime.
Boolean Variables
For boolean variables, the summary reports:
True: number of true valuesFalse: number of false values
String Variables
For string variables, the summary reports:
NumMissing: number of undefined valuesValues: unique string valuesCounts: occurence count of each value
Examples
// Create a table t = table([1; 2; %nan], [10; 20; 30], ... "VariableNames", ["A", "B"]); t.Properties.VariableDescriptions = ["First variable", "Second variable"]; t.Properties.VariableUnits = ["m", "s"]; // Display default summary summary(t) // Summary without statistics summary(t, "none") // Summary with all statistics summary(t, "allstats") // Summary for selected variables summary(t, "default", "A") // Return summary as a structure S = summary(t) disp(S.A.Mean)
--> t = table([1; 2; %nan], [10; 20; 30], ...
> "VariableNames", ["A", "B"]);
--> t.Properties.VariableDescriptions = ["First variable", "Second variable"];
--> t.Properties.VariableUnits = ["m", "s"];
// Display default summary
--> summary(t)
table: [3x2 table]
Variables:
A: double
Description: First variable
Units: m
B: double
Description: Second variable
Units: s
Statistics for numeric data:
A B
_________ ___
NumMissing 1 0
Min 1 10
Median 1 20
Max 2 30
Mean 1.5 20
Std 0.7071068 10
// Summary without statistics
--> summary(t, "none")
table: [3x2 table]
Variables:
A: double
Description: First variable
Units: m
B: double
Description: Second variable
Units: s
// Summary with all statistics
--> summary(t, "allstats")
table: [3x2 table]
Variables:
A: double
Description: First variable
Units: m
B: double
Description: Second variable
Units: s
Statistics for numeric data:
A B
_________ ___
NumMissing 1 0
Min 1 10
Median 1 20
Max 2 30
Q1 1 10
Mean 1.5 20
Q3 Nan 30
Std 0.7071068 10
Var 0.5 100
Mode 1 10
Range 1 20
Sum Nan 60
NumUnique 2 3
Nnz 2 3
// Summary for selected variables
--> summary(t, "default", "A")
table: [3x2 table]
Variables:
A: double
Description: First variable
Units: m
Statistics for numeric data:
A
_________
NumMissing 1
Min 1
Median 1
Max 2
Mean 1.5
Std 0.7071068
// Return summary as a structure
--> S = summary(t)
S = [struct] with fields:
A: [struct] with fields:
Size = [3,1]
Type = "double"
Description = "First variable"
Units = "m"
NumMissing = 1
Min = 1
Median = 1
Max = 2
Mean = 1.5
Std = 0.7071068
B: [struct] with fields:
Size = [3,1]
Type = "double"
Description = "Second variable"
Units = "s"
NumMissing = 0
Min = 10
Median = 20
Max = 30
Mean = 20
Std = 10
--> disp(S.A.Mean)
1.5
See also
- table — create a table from variables
- timeseries — create a timeseries - table with time as index
History
| Version | Description |
| 2026.1.0 | Function added. |
| Report an issue | ||
| << struct2table | Timeseries/Table | synchronize >> |