MATLAB 클래스
값 클래스, 핸들 클래스, System object를 사용하는 MATLAB 함수에 대한 코드를 생성할 수 있습니다. MATLAB의 값 클래스와 핸들 클래스에 대한 자세한 내용은 핸들 클래스와 값 클래스 비교 항목을 참조하십시오. System object에 대한 자세한 내용은 System object란? 항목을 참조하십시오.
코드 생성을 위한 MATLAB 코드에서는 다음을 수행할 수 있습니다.
MATLAB 코드에 MATLAB 값 클래스 또는 핸들 클래스를 사용할 수 있습니다.
MATLAB 값 클래스를 MATLAB 진입점에 대한 입력 인수로 사용할 수 있습니다.
C 코드를 생성할 경우 MATLAB 클래스는 구조체로 표현됩니다. C++ 코드를 생성하는 경우 코드 생성기의 디폴트 동작은 MATLAB 클래스에 대해 C++ 클래스를 생성하는 것입니다. 코드 생성을 위한 MATLAB 코드에 클래스를 사용하는 경우 특정 사용법 관련 참고 및 제한 사항을 알고 있어야 합니다.
클래스
coder.ClassType | 입력 사양에 허용되는 MATLAB 클래스 집합 표현 |
객체
coder.ClassSignature | Entry-point class for code generation (Tech Preview) (R2026a 이후) |
coder.FunctionSignature | Entry-point function or method for code generation (Tech Preview) (R2026a 이후) |
함수
addMethod | Add method specification to coder.ClassSignature object (Tech
Preview) (R2026a 이후) |
도움말 항목
코드 생성 기본 사항
- Class Limitations for Code Generation
Adhere to code generation restrictions when you use classes in MATLAB code for code generation. - Define Class Properties for Code Generation
Define the properties of value and handle classes in MATLAB code for code generation. - System Objects in MATLAB Code Generation
Special considerations for using System objects in code generated from MATLAB. - Code Generation for Handle Class Destructors
Use a handle class destructor in MATLAB code intended for code generation. - Generate C++ Code for MATLAB Classes
Generate a C++ class for a value class, handle class, or System object™ in your MATLAB code. - Generate Class Interface in C++ Code
Generate C++ code that is packaged into a class.
MATLAB 클래스를 진입점으로 사용(Tech Preview)
- Generate Standalone Code for Entry-Point Class (Tech Preview)
Use a MATLAB class as an entry-point for code generation. (R2026a 이후) - Generate C++ Executable for Entry-Point System Object in a Namespace (Tech Preview)
Use a System object in a namespace as an entry point for code generation. (R2026a 이후) - Generate and Use C++ Classes from Entry-Point Classes That Model a Physical System (Tech Preview)
Use generated entry-point C++ classes in a main function. (R2026a 이후)
MATLAB 함수에서 MATLAB 클래스 사용
- MATLAB 값 클래스에 대한 코드 생성하기
코드 생성을 위한 MATLAB 코드에 값 클래스를 사용합니다. - Generate Code for MATLAB Functions That Use Handle Classes
Use a handle class in MATLAB code intended for code generation. - Generate Code for MATLAB Functions That Use System Objects
Use a System object in MATLAB code for code generation. - Generate Code for MATLAB Functions That Use Singleton Classes
Use a singleton handle class in MATLAB code for code generation.
MATLAB 클래스를 진입점 입력 인수로 전달
- Specify Value Class Objects as Inputs
Specify that an entry-point input is an object of a value class.
문제 해결
Resolve Error: Handle Object Referenced by Persistent Variable
Troubleshoot error when using a persistent handle object.
Resolve Error: Nontunable Property Cannot Be Defined by Subscripted Assignment
Troubleshoot code generation failure when a System object uses a structure.
Resolve Error: Class Properties Must Be Fully Defined Before Use
Troubleshoot code generation error when class properties are not defined before use.
Resolve Error: Cannot Reference Handle Object Outside of Loop
Troubleshoot error when creating or allocating a handle object inside a
for-loop.
Resolve Error: Class Does Not Have Property
Troubleshoot issues when you assign a value to a property of a handle class that is returned by a method.
Resolve Error: Passing by Reference Not Supported for Some Properties
Troubleshoot error when you use certain types of properties with
coder.ref, coder.rref, or
coder.wref.
Resolve Error: Code Generator Failed to Produce C++ Destructor for MATLAB Class
Troubleshoot generation of standalone code for C++ destructor of a MATLAB class.
언어 제한 사항 해결: 코드 생성 시 객체 배열은 지원되지 않습니다
MATLAB 코드에서 객체로 구성된 배열에 대한 코드 생성 실패 문제를 해결합니다.
Resolve Error: coder.varsize Not Supported for Class Properties
Troubleshoot code generation error when using coder.varsize
with properties of a MATLAB class.
