tabular
datatypes: tabular
Abstract superclass of table and timetable.
tabular holds everything the two tabular classes share: their
common metadata properties, their variable storage, and the machinery
that does not depend on how rows are labelled. It is abstract and cannot
be instantiated; isa (obj, "tabular") is true for both
table and timetable, and neither derives from the other.
Everything that does depend on row labels is reached through a small set
of hooks that each subclass implements: table labels its rows with
RowNames and timetable with RowTimes.
Source Code: tabular
The tabular class contains the following properties:
Table description specified as a character vector or a string scalar.
If specified as a string scalar, it is converted and stored internally
as a character vector. You can access the Description property
of a table tbl with tbl.Properties.Description.
Additional table information, specified as an array. Any type of data
can be attached using this property. You can access the UserData
property of a table tbl with tbl.Properties.UserData.
Dimension names specified as a two-element cell array of character
vectors or a two-element string array. If specified as a string array,
it is converted and stored internally as a cell array of character
vectors. You can access the DimensionNames property of a table
tbl with tbl.Properties.DimensionNames.
By default, DimensionNames is specified as
'Row', 'Variables'. You can access table data per rows or per
columns by using either one of the two dimension names, respectively.
However, if the table contains row names, then the first element of the
DimensionNames corresponds to the row names.
Variable names, specified as a cell array of character vectors or a
string array. If specified as a string array, it is converted and stored
internally as a cell array of character vectors. All elements must be
nonempty and distinct, and their number must equal the number of
variables. You can access the data type of a specific variable by using
dot name assignment, as in tbl.varname, where
varname is the name of the variable in table tbl. If the
variable name does not exist, a new one is created.
The class of the data of each variable, defined as a cell array of
character vectors or a string array with the same number of elements as
the number of variables in the table. If specified as a string array,
it is converted and stored internally as a cell array of character
vectors. You can access the VariableTypes property of a table
tbl with tbl.Properties.VariableTypes. You can
further index specific variables to access their data type. Modifying
the elements of the VariableTypes property automatically converts
the underlying data of the corresponding variable into the specified
data types provided that a valid conversion is requested.
Variable descriptions, specified as a cell array of character vectors or
a string array. If specified as a string array, it is converted and
stored internally as a cell array of character vectors. If not empty
(default), it must contain the same number of elements as the number of
variables. If a specific variable does not have a description, this can
be specified with an individual empty character vector or an empty
string. You can access the VariableDescriptions property of a
table tbl with tbl.Properties.VariableDescriptions.
You can further index specific variables to access their description.
Assigning an empty cell or string array returns the property to its
default, and describing a single variable of a table that has no
descriptions gives the remaining variables an empty description.
Variable units, specified as a cell array of character vectors or a
string array. If specified as a string array, it is converted and stored
internally as a cell array of character vectors. If not empty (default),
it must contain the same number of elements as the number of variables.
If a specific variable does not have a unit, this can be specified with
an individual empty character vector or an empty string. You can access
the VariableUnits property of a table tbl with
tbl.Properties.VariableUnits. You can further index
specific variables to access their unit. Assigning an empty cell or
string array returns the property to its default, and giving a unit to
a single variable of a table that has none gives the remaining
variables an empty unit.
Continuity of each variable, specified as a cell array of character
vectors or a string array carrying one element per variable, each of
them 'unset', 'continuous', 'step' or
'event'. It is empty by default, and assigning {} or
[] clears it. If specified as a string array, it is converted
and stored internally as a cell array of character vectors. You can
access it with tbl.Properties.VariableContinuity and you
can index individual variables to read or assign their continuity.
A table carries the property but does not act on it, which is
also how MATLAB behaves. A timetable uses it to choose the
default fill method of each variable when resampling.
MATLAB stores this property as a matlab.tabular.Continuity
enumeration. Octave has no enumeration classes, so it is stored and
returned here as a cell array of character vectors, as
VariableNames and VariableUnits are.
Custom properties that contain metadata of a table and its variables.
By default, this is an empty container. Each custom property holds
either table metadata or per-variable metadata, according to the property
type ('table' or 'variable') specified when the property
is created with the addprop method. A variable-scoped property
holds one element per variable.
You can add an individual custom property only by using the
addprop method and you can only remove a custom property with the
rmprop method. To access existing custom properties use dot name
structure assignment as in
tbl.Properties.CustomProperties.PropertyName, where
PropertyName is the name used with the addprop method.
The whole set may also be taken from another table by assigning that
table’s CustomProperties to this one, which replaces every
custom property with those of the other table, their types included. A
variable-scoped property arriving that way must hold one element for
each variable of the receiving table, or be a 0-by-0 empty. Nothing
else can be assigned there.
The tabular class offers the following public methods: