MATLAB 代码准备
在代码生成之前识别并修复 MATLAB® 代码中的问题
要从 MATLAB 代码成功生成 C/C++ 代码,需要遵循代码生成规则和限制。例如,您的 MATLAB 代码只能使用代码生成支持的函数和对象。要在生成 C/C++ 代码之前识别和修复 MATLAB 代码的问题,您可以使用代码分析器和代码生成就绪工具进行检查。
函数
coder.screener | 确定函数是否适合代码生成 |
getLineColumn | Find locations of beginning and end of MATLAB code involved in code generation |
textReport | Export code generation readiness report to base workspace as a character vector (自 R2022a 起) |
属性
| coder.CallSite Properties | Information about a function call site in your MATLAB code (自 R2022a 起) |
| coder.CodeFile Properties | Description of file containing text that is involved in code generation |
| coder.File Properties | Description of file without text that is involved in code generation |
| coder.Message Properties | Description of message produced during code generation readiness analysis or during code generation |
| coder.ScreenerInfo Properties | Code generation readiness information (自 R2022a 起) |
主题
准备代码生成
- 确定入口函数并检查 MATLAB 代码
在代码生成之前,确定入口函数并检查 MATLAB 代码是否有错误。 - 代码生成就绪工具
代码生成就绪工具会筛查 MATLAB 代码中是否存在代码生成不支持的功能和函数。
故障排除
- 解决错误:代码生成不支持函数
对不支持的 MATLAB 函数的代码生成失败进行故障排除。