Concatenation appends the categories exclusive to the second input, soda, to the end of
the list of categories from the first input, milk, water, juice, soda.
Use reordercats to change the order of the categories in the categorical array,
students.
students = reordercats(students,{'juice','milk','water','soda'});
categories(students)
ans = 4x1 cell array
{'juice'}
{'milk' }
{'water'}
{'soda' }
Union of Categorical Arrays
Use the function union to find the unique responses from Group1 and Group2.
C = union(Group1,Group2)
C = 4x1 categorical array
milk
water
juice
soda
union returns the combined values from Group1 and Group2 with no repetitions. In this
case, C is equivalent to the categories of the concatenation, students.
All of the categorical arrays in this example were nonordinal. To combine ordinal
categorical arrays, they must have the same sets of categories including their order.
See Also
cat | categorical | categories | horzcat | summary | union | vertcat
Related Examples
- “Create Categorical Arrays” on page 8-2
See Also