mergevars
Combine table or timetable variables into multicolumn variable
Syntax
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"])
. The combined
variable in T2
is named var3
.
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(___,'MergeAsTable',true)
merges
the specified variables into a table, instead of an array. The new table is itself a
variable of the output table T2
. Use this syntax to combine
variables that cannot be concatenated into an array. You can use this syntax with
any of the input arguments from the previous syntaxes.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced in R2018a