입력 사양
코드 생성 활성화를 위해 MATLAB® 함수 입력 변수의 속성 지정
코드 생성 시 진입점 함수에 대한 입력 변수의 크기와 유형을 지정해야 합니다. 다음과 같은 방법으로 입력 유형을 지정할 수 있습니다.
MATLAB 코드에서
arguments
블록을 사용하여 진입점 함수에서 함수 인수의 유효성 검사를 수행합니다.arguments
블록을 사용하여 입력 유형을 지정하는 경우 유효성 검사기(예:coder.mustBeComplex
)를 사용하여 다른 변수 특성(예: 입력 데이터가 복소수인지, 희소 형식인지 또는 GPU 배열인지)을 지정할 수도 있습니다.MATLAB Coder™ 앱을 사용합니다.
명령줄에서
codegen
명령에-args
인수를 사용합니다.-args
인수를 사용하여 명령줄에 지정하는 입력 유형은coderTypeEditor
또는 함수(예:coder.typeof
)를 사용하여 미리 구성할 수 있습니다.MATLAB 코드에서
assert
문을 사용하여 사전 조건 지정을 수행합니다.
앱
MATLAB Coder | MATLAB 코드에서 C 코드 또는 MEX 함수 생성 |
함수
클래스
객체
coder.OutputType | Output type from an entry-point function to specify as an input type |
도움말 항목
입력 사양 기본 사항
- 진입점 함수 입력값의 유형 지정하기
입력 유형 지정을 수행하는 방법과 그 이유. - Specify Number of Input or Output Arguments to Entry-Point Functions
Control the number of input or output arguments in the generated code. - Specify Value Class Objects as Inputs
Specify that an entry-point input is an object of a value class.
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.
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.
명령줄에서 입력 유형 지정하기
- 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. - Pass an Entry-Point Function Output as an Input
Simplify input type specification for multiple entry-point functions. - 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 String Scalar Inputs at the Command Line
Specify string scalar inputs at the command line.
문제 해결하기
- 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.