union
(Not Recommended) Set union for dataset array observations
The dataset
data type is not recommended. To work with heterogeneous data,
use the MATLAB®
table
data type instead. See MATLAB
table
documentation for more information.
Description
returns the combined set of observations from the two arrays, with repetitions of unique
combinations of the variables specified in C
= union(A,B
,vars
)vars
removed. The
observations in the dataset array C
are sorted by those
variables.
The values for variables not specified in vars
for each observation
in C
are taken from the corresponding observation in
A
or B
, or from A
if there are
common observations in both A
and B
. If there are
multiple observations in A
or B
that correspond to an
observation in C
, those values are taken from the first
occurrence.
[
also returns index vectors C
,iA
,iB
]
= union(___)iA
and
iB
such that C
is a sorted combination of the
values A(iA,:)
and B(iB,:)
. If there are common
observations in A
and B
, then union
returns only the index from A
, in iA
. If there are
repeated observations in A
or B
, then the index of the
first occurrence is returned. You can use any of the previous input arguments.
Input Arguments
Output Arguments
Version History
Introduced in R2012b