You can define categorical array inputs at the command line or in the
MATLAB®
Coder™ app. Programmatic specification of categorical input types by using
preconditioning (assert
statements) is not supported.
Use one of these procedures:
Alternatively, if you have a test file that calls your entry-point function with example
inputs, you can determine the input types by using
coder.getArgTypes
.
Use the -args
option:
C = categorical({'r','g','b'}); codegen myFunction -args {C}
To provide a type for a categorical array to codegen
:
Define a categorical array. For example:
C = categorical({'r','g','b'});
Create a type from
C
.
t = coder.typeof(C);
Pass the type to codegen
by using the
-args
option.
codegen myFunction -args {t}
To specify that a categorical array input is constant, use
coder.Constant
with the -args
option:
C = categorical({'r','g','b'}); codegen myFunction -args {coder.Constant(C)}
Use one of these procedures:
categorical
| coder.Constant
| coder.typeof