MATLAB Coder
R2026bMATLAB® Coder™ 从 MATLAB 代码生成适用于各种硬件平台(从桌面计算机系统到嵌入式硬件)的 C/C++ 代码。它支持大多数 MATLAB 语言和广泛的工具箱。您可以将可读且可移植的生成代码作为源代码、静态库或动态库集成到现有 C/C++ 工程中。MATLAB Coder 允许您将生成的代码打包为 MEX 函数以在 MATLAB 中使用。您可以通过合并多核和向量化代码并调用优化库来优化生成的代码。
MATLAB Coder 提供代码自定义、硬件特定优化、代码可追溯性、使用软件在环 (SIL) 和处理器在环 (PIL) 测试的代码验证,以及 MISRA™ 规范的代码合规性(使用 Embedded Coder®)。
要在 MATLAB 支持的主机平台上部署 MATLAB 程序,请使用 MATLAB Compiler™。
MATLAB Coder 快速入门
MATLAB Coder 基础知识学习
用于代码生成的 MATLAB 编程
用于代码生成的 MATLAB 语言语法和函数;数据定义
代码生成
C/C++ 和 MEX 代码生成、修复错误、行为验证
部署
使用并运行生成的 C/C++ 代码
性能
缩短代码生成时间,提高执行速度,减少所生成代码的内存使用量
MATLAB 算法加速
使用生成的 MEX 函数加速代码执行
数值转换
定点转换、单精度转换(需要 Fixed-Point Designer™)
使用 MATLAB Coder 进行深度学习
生成用于深度学习神经网络的 C/C++ 代码(需要 Deep Learning Toolbox™)
为 PyTorch 和 LiteRT 模型生成代码
为 PyTorch® ExportedProgram 和 LiteRT 模型生成 C、C++ 和 CUDA 代码
MATLAB Coder 支持的硬件
对第三方硬件的支持
查看 Bug 报告以确定并解决问题
Software is inherently complex and is not free of errors. The output of a code generator might contain bugs, some of which are not detected by a compiler. MathWorks reports critical known bugs brought to its attention on its Bug Report system at www.mathworks.com/support/bugreports/. Click the "Incorrect Code Generation" filter to obtain a report of known bugs that produce code that might compile and execute, but still produce wrong answers. To save the filtered results, click Save Search.
The bug reports are an integral part of the documentation for each release. Examine periodically all bug reports for a release, as such reports may identify inconsistencies between the actual behavior of a release you are using and the behavior described in this documentation.
In addition to reviewing bug reports, you should implement a verification and validation strategy to identify potential bugs in your design, code, and tools.