Multiplication with Undefined Elements
Combine two categorical arrays. If either A or B have an undefined element, the corresponding
element of C is undefined.
A = categorical({'blue','red','green','black'});
B = categorical({'+','-','+','-'});
A = removecats(A,{'black'});
C = A.*B
C = 1x4 categorical
blue +
red -
green +

Cartesian Product of Ordinal Categorical Arrays
Combine two ordinal categorical arrays. C is an ordinal categorical array only if A and B are both
ordinal. The ordering of the categories of C follows from the orderings of the input categorical arrays.
A = categorical({'blue','red','green'},{'green','red','blue'},'Ordinal',true);
B = categorical({'+','-','+'},'Ordinal',true);
C = A.*B;
categories(C)
ans = 6x1 cell
{'green +'}
{'green -'}
{'red +' }
{'red -' }
{'blue +' }
{'blue -' }
See Also
categorical | categories | summary | times
Related Examples
•
“Create Categorical Arrays” on page 8-2
•
“Combine Categorical Arrays” on page 8-19
•
“Access Data Using Categorical Arrays” on page 8-24
More About
•
“Ordinal Categorical Arrays” on page 8-36
Combine Categorical Arrays Using Multiplication
8-23
Précédent

- 327/1450

Suivant