구조체
구조체에 대한 코드 생성
MATLAB® Coder™는 연산에 대한 제한 사항, 스칼라 구조체 값의 속성에 대한 제한 사항 및 구조체 배열에 제한 사항이 있는 구조체의 코드 생성을 지원합니다. 구조체형 배열뿐만 아니라 스칼라 구조체에 대한 코드도 생성할 수 있습니다. 하위 구조체와 필드에 값을 인덱싱하고 할당할 때 관련 제한 사항을 준수하십시오. 구조체 인수는 생성 코드에서 참조로 또는 값으로 전달됩니다.
함수
coder.cstructname | Name generated or externally defined structure type in C or C++ code |
도움말 항목
- Structure Limitations for Code Generation
Adhere to code generation restrictions for structures.
- 구조체형 배열에 대한 코드 생성하기
이 예제에서는 코드 생성에 적합하도록 구조체형 배열을 사용하는 MATLAB 함수를 작성하는 방법을 보여줍니다.
- Pass Structure Arguments by Reference or by Value in Standalone Code
Control whether structure arguments are passed by reference or by value.
- Name C Structure Type to Use with Global Structure Variable
Use
coder.cstructnameto define a type object for a global structure. - Synchronize MATLAB Structure with Structure Type in Generated Code
Use a constructor function and
coder.OutputTypeto generate a structure type that you can use in MATLAB functions and the generated code.
문제 해결
오류 해결: 변수를 사용하기 전에 완전히 정의해야 합니다
변수를 사용하기 전에 변수가 정의되지 않은 경우에 발생하는 코드 생성 오류를 해결합니다.