算法设计基础知识
有关代码生成以及所生成代码的行为的算法设计注意事项
函数
coder.allowpcode | 从 P 代码文件控制代码生成 |
coder.ceval | 调用外部 C/C++ 函数 |
coder.cinclude | 在生成的代码中包括头文件 |
coder.cstructname | 在生成代码中命名 C 结构体类型 |
coder.extrinsic | 将函数声明为外部函数,并在 MATLAB 中执行它 |
coder.inline | 控制生成的代码中特定函数的内联 |
coder.load | 从 MAT 文件或 ASCII 文件加载编译时常量 |
coder.nullcopy | 在代码生成中声明未初始化的变量 |
coder.opaque | 在生成的代码中声明变量 |
coder.ref | 指示要传引用的数据 |
coder.screener | 确定函数是否适合代码生成 |
coder.rref | 指示要传引用的只读数据 |
coder.target | 确定代码生成目标是否为指定的目标 |
coder.unroll | 通过为每次循环迭代生成循环体的副本来展开 for 循环 |
coder.varsize | 声明可变大小数据 |
coder.wref | 指示要按引用传递的只写数据 |
coder.updateBuildInfo | Update build information object RTW.BuildInfo |
类
coder.ExternalDependency | Interface to external code |
coder.BuildConfig | 代码生成期间的编译上下文 |
示例和操作指南
- 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 算法生成代码的情况
决定是否为您的应用程序生成代码。
- 使用合适的代码生成功能
为您的应用程序选择代码生成功能。
- 从 MATLAB 生成 C/C++ 代码的前提条件
从 MATLAB® 代码生成代码需要 MATLAB Coder™ 产品和 C/C++ 编译器。
- 生成的代码和 MATLAB 代码之间的差异
生成的 C/C++ 代码的行为可能与原始的 MATLAB 源代码不同。
- 代码生成就绪工具
代码生成就绪工具会筛查 MATLAB 代码中是否存在代码生成不支持的功能和函数。
- 支持 C/C++ 代码生成的 MATLAB 语言功能
使用代码生成支持的 MATLAB 语言功能和函数。
- 针对代码生成的 MATLAB 代码设计注意事项
为代码生成编写 MATLAB 代码时,请注意相关限制。
疑难解答
Unknown Output Type for coder.ceval
Define the output type for external C/C++ function calls.