MATLAB Coder 快速入门
MATLAB® Coder™ 从 MATLAB 代码生成适用于各种硬件平台(从桌面计算机系统到嵌入式硬件)的 C/C++ 代码。它支持大多数 MATLAB 语言和广泛的工具箱。您可以将可读且可移植的生成代码作为源代码、静态库或动态库集成到现有 C/C++ 工程中。MATLAB Coder 允许您将生成的代码打包为 MEX 函数以在 MATLAB 中使用。您可以通过合并多核和向量化代码并调用优化库来优化生成的代码。
MATLAB Coder 提供代码自定义、硬件特定优化、代码可追溯性、使用软件在环 (SIL) 和处理器在环 (PIL) 测试的代码验证,以及 MISRA™ 规范的代码合规性(使用 Embedded Coder®)。
要在 MATLAB 支持的主机平台上部署 MATLAB 程序,请使用 MATLAB Compiler™。
教程
- 步骤 1: Prepare MATLAB Function for Code Generation
- 步骤 2: Automatically Define Input Types in the MATLAB Coder App
- 步骤 3: Check for Code Generation Issues by Generating and Running a MEX Function
- 步骤 4: Configure Code Generation Settings and Generate Code
- 步骤 5: Verify Generated Code by Using SIL or PIL
- 步骤 6: Optimize and Deploy Generated Code
- Diagnose Common Code Generation Errors and Warnings
Learn how to resolve common errors when generating C or C++ code from MATLAB code.
使用 MATLAB Coder 从示例 MATLAB 函数生成 C 代码。
关于通过 MATLAB 算法生成代码
- Decide Which Code Generation Product to Use
Understand the differences between MATLAB Coder and other MathWorks® products.
- 代码生成的输入类型设定
输入类型设定如何影响生成的 C/C++ 代码。
- 生成代码和 MATLAB 代码的形式差异
由于代码生成器会进行优化,生成代码与 MATLAB 代码的形式会有所不同。
- 配置代码生成和编译设置
在命令行或 MATLAB Coder 中配置代码生成和编译配置参数。
- 使用 MATLAB Coder 进行代码生成的概述
MATLAB Coder 代码生成工作流。
精选示例
交互式学习
MATLAB Coder 入门之旅
学习从 MATLAB 函数生成 C 和 C++ 代码的基础知识。
视频
从 MATLAB 代码生成 C 代码
从 MATLAB 代码生成 C/C++ 代码的工作流。


