Specification of input types and properties is required for code generation. The
code generator uses the input information to determine what types, sizes, and other
properties are produced for subsequent variable definition. Perform input
specification from the app, at the command line, or by using the Coder Type Editor,
and from outside or inside of your function code, using functions such as coder.typeof
, coder.varsize
, and assert
. For certain input types
such as cells, classes, and globals, input specification can involve additional
considerations.
coder.getArgTypes | Determine types of function input arguments by executing test file |
coder.newtype | Create a coder.Type object to represent the type of an
entry-point function input |
coder.resize | Resize coder.Type object |
coder.typeof | Create coder.Type object to represent the type
of an entry-point function input |
coder.varsize | Declare variable-size data |
coderTypeEditor | Launch the Coder Type Editor dialog |
coder.ArrayType | Represent set of MATLAB arrays |
coder.CellType | Represent set of MATLAB cell arrays |
coder.ClassType | Represent set of MATLAB classes |
coder.Constant | Represent set containing one MATLAB value |
coder.EnumType | Represent set of MATLAB enumerations |
coder.FiType | Represent set of MATLAB fixed-point arrays |
coder.PrimitiveType | Represent set of logical, numeric, or char arrays |
coder.StructType | Represent set of MATLAB structure arrays |
coder.Type | Represent set of MATLAB values |
coder.OutputType | Output type from an entry-point function to specify as an input type |
Specify Properties of Entry-Point Function Inputs
Specify input properties so that the code generator can determine the properties of all variables.
Automatically Define Input Types by Using the App
Provide a test that calls the entry-point functions with representative data.
Specify Number of Entry-Point Function Input or Output Arguments to Generate
Control the number of arguments in generated entry-point functions.
Define Input Properties Programmatically in the MATLAB File
Define the properties of entry-point function inputs
with the assert
function.
Create and Edit Input Types by Using the Coder Type Editor
Define and edit coder.Type
objects interactively.
Pass an Entry-Point Function Output as an Input
Simplify input type specification for multiple entry-point functions.
Define Input Parameter by Example by Using the App
Specify properties of an input parameter by providing an example value.
Define or Edit Input Parameter Type by Using the App
Specify the class, size, and complexity of an input parameter.
Make Dimensions Variable-Size When They Meet Size Threshold
Specify and apply rules for making dimensions variable-size.
Undo and Redo Changes to Type Definitions in the App
Revert and restore changes to input or global variable definitions.
Choose how you want to specify cell array inputs.
Specify Cell Array Inputs at the Command Line
Provide an example cell array, define a cell array type, or specify a cell array constant input.
Specify Global Cell Arrays at the Command Line
Specify global cell array inputs with the -globals
option.
Specify Objects as Inputs at the Command Line
Specify that an entry-point input is an object of
a value class by using the codegen
-args
option.
Specify Objects as Inputs in the MATLAB Coder App
Define the type of a value class input from a test file or an example input.
Generate C/C++ code from MATLAB code that uses global data
Add Global Variables by Using the App
Define global variables.
Specify Global Variable Type and Initial Value Using the App
Specify type and initial value of global variables that your MATLAB code uses.
Constant Input Checking in MEX Functions
Control whether a MEX function checks the value of a constant input argument.
Define Constant Input Parameters Using the App
Specify that an input parameter is a constant.