Main Content

입력 사양

코드 생성 활성화를 위해 MATLAB® 함수 입력 변수의 속성 지정

코드 생성 시 진입점 함수에 대한 입력 변수의 크기와 유형을 지정해야 합니다. 다음과 같은 방법으로 입력 유형을 지정할 수 있습니다.

  • MATLAB 코드에서 arguments 블록을 사용하여 진입점 함수에서 함수 인수의 유효성 검사를 수행합니다. arguments 블록을 사용하여 입력 유형을 지정하는 경우 유효성 검사기(예: coder.mustBeComplex)를 사용하여 다른 변수 특성(예: 입력 데이터가 복소수인지, 희소 형식인지 또는 GPU 배열인지)을 지정할 수도 있습니다.

  • MATLAB Coder™ 앱을 사용합니다.

  • 명령줄에서 codegen 명령에 -args 인수를 사용합니다. -args 인수를 사용하여 명령줄에 지정하는 입력 유형은 coderTypeEditor 또는 함수(예: coder.typeof)를 사용하여 미리 구성할 수 있습니다.

  • MATLAB 코드에서 assert 문을 사용하여 사전 조건 지정을 수행합니다.

MATLAB CoderMATLAB 코드에서 C 코드 또는 MEX 함수 생성

함수

모두 확장

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.resizecoder.Type 객체의 크기 변경
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.ClassType입력 사양에 허용되는 MATLAB 클래스 집합 표현
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.StructType입력 사양에 허용되는 MATLAB 구조체형 배열 집합 표현
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

도움말 항목

입력 사양 기본 사항

MATLAB 코드에서 입력 유형 지정하기

MATLAB Coder 앱을 사용하여 입력 유형 지정하기

명령줄에서 입력 유형 지정하기

문제 해결하기