Especificación de la entrada
Para generar código, debe especificar los tamaños y tipos de variables de entrada a la función de punto de entrada. Puede especificar tipos de entrada de la siguiente forma:
En el código de MATLAB, cuando realiza la validación de argumentos de función en la función de punto de entrada con bloques de
arguments
. Si especifica tipos de entrada mediante bloques dearguments
, también puede especificar otros atributos de variables, incluso si los datos de entrada son complejos, dispersos o un arreglo GPU, mediante validadores comocoder.mustBeComplex
.Con la app MATLAB Coder™.
En la línea de comandos, mediante el argumento
-args
con el comandocodegen
. Los tipos de entrada especificados en la línea de comandos mediante el argumento-args
pueden preconfigurarse mediantecoderTypeEditor
o funciones comocoder.typeof
.En su código de MATLAB, realizando el precondicionado mediante instrucciones
assert
.
Apps
MATLAB Coder | Generar código C o una función MEX a partir de código de MATLAB |
Funciones
Clases
Objetos
coder.OutputType | Output type from an entry-point function to specify as an input type |
Temas
Conceptos básicos de la especificación de entrada
- Specify Types of Entry-Point Function Inputs
How and why to perform input-type specification.
Especificar tipos de entrada en código de MATLAB
- Use Function Argument Validation to Specify Entry-Point Input Types
Specify the types of the entry-point function inputs using anarguments
block. - Specify Input Types Using assert Statements in MATLAB Code
Specify the types of entry-point function inputs by using theassert
function.
Especificar tipos de entrada mediante la app MATLAB Coder
- Define Types of Entry-Point Inputs by Using the MATLAB Coder App
Specify the types of entry-point function inputs using the MATLAB Coder app. - Define Global Variables in the MATLAB Coder App
Use the MATLAB Coder app to specify the types and initial values of global variables that your MATLAB code uses.
Especificar tipos de entrada en la línea de comandos
- Specify Input Types at the Command Line
Specify entry-point function input type by using the-args
option. - Create and Edit Input Types by Using the Coder Type Editor
Define and editcoder.Type
objects interactively. - 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 Value Class Objects as Inputs
Specify that an entry-point input is an object of a value class. - Pass an Entry-Point Function Output as an Input
Simplify input type specification for multiple entry-point functions. - Specify String Scalar Inputs at the Command Line
Specify string scalar inputs at the command line. - Specify Number of Input or Output Arguments to Entry-Point Functions
Control the number of input or output arguments in the generated code.
Resolución de problemas
- Resolve Issue: Using arguments Blocks to Specify Cell or Structure Entry-Point Input Types is Not Supported
Troubleshoot code generation error if cells or structs are used for input-type specification in the arguments block of an entry-point function.