categorical.double
categorical: out = double (C)
Convert categorical array to a double array.
out = double (C) returns a double array indexing the
categories in C. Categorical elements of undefined category are
returned as NaN.
Source Code: categorical
double returns the integer category codes — each value's 1-based index into the category list. <undefined> elements map to NaN.
C = categorical ({'S'; 'M'; 'L'; ''; 'S'}, {'S', 'M', 'L'}, 'Ordinal', true)
C =
5x1 categorical array
S
M
L
<undefined>
S
categories (C)
ans =
3x1 cell array
{'S'}
{'M'}
{'L'}
double (C)
ans =
1
2
3
NaN
1