mergevars
Combine table or timetable variables into multicolumn variable
Description
T2 = mergevars(
combines the table variables specified by T1
,vars
)vars
to create one
multicolumn variable in T2
. All other variables from
T1
are unaltered. You can specify variables by name, by
position, or using logical indices.
For example, if T1
has variables named var3
and var5
, then you can combine them into a variable that has two
columns by using T2 = mergevars(T1,["var3","var5"])
.
By default, the name of the merged variable in T2
takes the
form Var
, where
N
is the position of the
merged variable. For example, if the merged variable is the third variable in
N
T2
, then its name is Var3
.
To split multicolumn variables, use the splitvars
function.
T2 = mergevars(
specifies options using one or more name-value arguments in addition to the input
arguments in the previous syntax. For example, to specify a name for the merged
variable, set T1
,vars
,Name,Value
)NewVariableName
to the name that you
specify.
Examples
Input Arguments
Name-Value Arguments
Extended Capabilities
Version History
Introduced in R2018a