Group1 = [A;B];
Summarize the categorical array, Group1
summary(Group1)
milk 20
water 18
juice 15
Group1 is a 53-by-1 categorical array with three categories: milk, water, and juice.
Create Categorical Array with Different Categories
Create a categorical array, Group2, containing data from 50 students who were given the
additional beverage option of soda.
Group2 = gallery('integerdata',4,[50,1],2);
Group2 = categorical(Group2,1:4,{'juice' 'milk' 'soda' 'water'});
Summarize the categorical array, Group2.
summary(Group2)
juice 18
milk 10
soda 13
water 9
Group2 is a 50-by-1 categorical array with four categories: juice, milk, soda, and
water.
Concatenate Arrays with Different Categories
Concatenate the data from Group1 and Group2.
students = [Group1;Group2];
Summarize the resulting categorical array, students.
summary(students)
milk 30
water 27
juice 33
soda 13
8 Categorical Arrays