Main Content

Input Specification

Specify properties of MATLAB® function input variables to enable code generation

For code generation, you must specify the sizes and types of input variables to the entry-point function. You can specify input types:

  • In your MATLAB code, by performing function argument validation in the entry-point function using arguments blocks. If you specify input types using arguments blocks, you can also specify other variable attributes, including whether the input data is complex, sparse, or a GPU array, using validators such as coder.mustBeComplex.

  • Using the MATLAB Coder™ app.

  • At the command line, using the -args argument to the codegen command. Input types specified at the command line using the -args argument can be pre-configured using the coderTypeEditor or functions such as coder.typeof.

  • In your MATLAB code, by performing preconditioning using assert statements.

MATLAB CoderGenerate C code or MEX function from MATLAB code

함수

모두 확장

codegenGenerate C/C++ code from MATLAB code
coder.getArgTypesDetermine types of function input arguments by executing test file
coder.newtypeCreate coder.Type object to represent type of an entry-point function input
coder.resizeResize coder.Type object
coder.typeofCreate coder.Type object to represent the type of an entry-point function input
arguments함수 인수 유효성 검사 선언 (R2019b 이후)
coder.mustBeComplexValidate that value lies on the complex plane (R2023b 이후)
coder.specifyAsGPUSpecify that value is a GPU input to an entry-point function for GPU code generation (R2023b 이후)
coder.varsizeDeclare variable-size data
mustBeAValidate that value comes from one of specified classes (R2020b 이후)
mustBeNonsparseValidate that value is nonsparse
mustBeRealValidate that value is real
mustBeSparseValidate that value is sparse (R2023b 이후)
assert조건이 false인 경우 오류 발생시키기(Throw Error)

클래스

모두 확장

coder.ArrayTypeRepresent set of MATLAB arrays acceptable for input specification
coder.CellTypeRepresent set of MATLAB cell arrays
coder.ClassTypeRepresent set of MATLAB classes acceptable for input specification
coder.ConstantSpecification of constant value for code generation
coder.EnumTypeRepresent set of MATLAB enumerations acceptable for input specification
coder.FiTypeRepresent set of MATLAB fixed-point arrays acceptable for input specification
coder.PrimitiveTypeRepresent set of logical, numeric, or character arrays acceptable for input specification
coder.StructTypeRepresent set of MATLAB structure arrays acceptable for input specification
coder.StringTypeRepresent set of MATLAB strings acceptable for input specification (R2022b 이후)
coder.TypeRepresent set of MATLAB values acceptable for input specification

객체

coder.OutputTypeOutput type from an entry-point function to specify as an input type

도움말 항목

Input Specification Basics

Specify Input Types in MATLAB Code

Specify Input Types Using MATLAB Coder App

Specify Input Types at the Command Line

Troubleshooting