이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.
알고리즘 설계 기본 사항
MATLAB® 알고리즘에서 코드를 생성하면 완전히 MATLAB 작업 공간 내에서 소프트웨어를 설계하고 구현하며 테스트할 수 있습니다. 가능한 작업:
알고리즘이 코드 생성에 적합한지 확인할 수 있습니다.
효율적이고 읽기 가능하며 간소한 C/C++ 코드를 자동으로 생성하여 수동 변환을 없애고 코드에 오류가 발생할 위험을 최소화할 수 있습니다.
데이터형 관리, 메모리 사용, 속도 등 데스크탑과 임베디드 애플리케이션의 특정 요구 사항을 고려하여 MATLAB 코드의 설계를 수정할 수 있습니다.
생성된 코드를 테스트하고 수정된 알고리즘이 원래 MATLAB 알고리즘과 기능적으로 같은지 손쉽게 확인할 수 있습니다.
MEX 함수를 생성하여 MATLAB 알고리즘을 가속화하거나 고정소수점 MATLAB 코드의 속도를 높일 수 있습니다.
MATLAB 코드에서 하드웨어 기술 언어(HDL)를 생성할 수 있습니다.
함수
coder.allowpcode | P 코드 파일로부터 코드 생성 |
coder.ceval | Call C/C++ function from generated code |
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 compile-time constants from MAT-file or ASCII file |
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 | Declare variable-size data |
coder.wref | Indicate write-only data to pass by reference |
coder.updateBuildInfo | Update build information object RTW.BuildInfo |
클래스
coder.ExternalDependency | Interface to external code |
coder.BuildConfig | Build context during code generation |
도움말 항목
- When to Generate Code from MATLAB Algorithms
Decide whether to generate code for your application.
- Which Code Generation Feature to Use
Choose code generation feature for your application.
- Prerequisites for C/C++ Code Generation from MATLAB
Code generation from MATLAB code requires the MATLAB Coder™ product and a C/C++ compiler.
- 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 current folder browser.
- MATLAB Language Features Supported for C/C++ Code Generation
Use the MATLAB language features and functions that code generation supports.
- 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.