알고리즘 설계 기본 사항
MATLAB® 알고리즘에서 코드를 생성하면 완전히 MATLAB 작업 공간 내에서 소프트웨어를 설계하고 구현하며 테스트할 수 있습니다. 다음을 수행할 수 있습니다.
알고리즘이 코드 생성에 적합한지 확인할 수 있습니다.
효율적이고 읽기 가능하며 간소한 C/C++ 코드를 자동으로 생성하여 수동 변환을 없애고 코드에 오류가 발생할 위험을 최소화할 수 있습니다.
데이터형 관리, 메모리 사용, 속도 등 데스크탑과 임베디드 애플리케이션의 특정 요구 사항을 고려하여 MATLAB 코드의 설계를 수정할 수 있습니다.
생성된 코드를 테스트하고 수정된 알고리즘이 원래 MATLAB 알고리즘과 기능적으로 같은지 손쉽게 확인할 수 있습니다.
MEX 함수를 생성하여 MATLAB 알고리즘을 가속화하거나 고정소수점 MATLAB 코드의 속도를 높일 수 있습니다.
MATLAB 코드에서 하드웨어 기술 언어(HDL)를 생성할 수 있습니다.
MATLAB 알고리즘에서 C/C++ 또는 MEX 코드를 생성하려면 MATLAB Coder™와 C/C++ 컴파일러가 설치되어 있어야 합니다.
함수
coder.allowpcode | P 코드 파일로부터 코드 생성 |
coder.ceval | 생성 코드에서 C/C++ 함수 호출 |
coder.cinclude | Include header file in generated code |
coder.cstructname | Name C structure type in generated code |
coder.extrinsic | 함수를 외재적 함수로 선언하고 MATLAB에서 실행 |
coder.inline | Control inlining of current function in generated code |
coder.inlineCall | Inline called function in generated code (R2024a 이후) |
coder.load | Load constants from MAT file or ASCII file at code generation time |
coder.nonInlineCall | Prevent inlining of called function in generated code (R2024a 이후) |
coder.nullcopy | 생성 코드에서 초기화되지 않은 변수 선언하기 |
coder.opaque | Declare variable in generated code |
coder.ref | Indicate data to pass by reference |
coder.screener | Determine if function is suitable for code generation |
coder.rref | Indicate read-only data to pass by reference |
coder.target | Determine if code generation target is specified target |
coder.unroll | Unroll for -loop by making a copy of
the loop body for each loop iteration |
coder.varsize | Resolve size incompatibility errors and declare upper bounds |
coder.wref | Indicate write-only data to pass by reference |
coder.updateBuildInfo | Update RTW.BuildInfo build information object |
클래스
coder.ExternalDependency | Interface to external code |
coder.BuildConfig | Build context during code generation |
도움말 항목
- MATLAB 알고리즘에서 코드를 생성해야 하는 경우
애플리케이션에 대해 코드를 생성할지 여부를 결정합니다.
- Which Code Generation Feature to Use
Choose code generation feature for your application.
- Differences Between Generated Code and MATLAB Code
Generated C/C++ code can behave differently than original MATLAB source code.
- 코드 생성 준비 툴
코드 생성 준비 툴은 MATLAB 코드에 코드 생성에서 지원하지 않는 기능과 함수가 있지 않은지 검사합니다.
- Check Code Using the Code Generation Readiness Tool
Run the code generation readiness tool at the command line or from the Files panel.
- C/C++ 코드 생성에 지원되는 MATLAB 언어 기능
코드 생성에 지원되는 MATLAB 언어 기능과 함수를 사용합니다.
- MATLAB Code Design Considerations for Code Generation
When writing MATLAB for code generation, consider design constraints.
문제 해결
Unknown Output Type for coder.ceval
Define the output type for external C/C++ function calls.