生成代码
C/C ++代码生成是MATLAB®CODER™。Generate code from the app, which you can open withcoder
, or from the command line, by using the代码根
function. The app provides step-by-step guidance through the code generation process, including guidance for best practices, and clear visual aids for the code generation settings and options. The command line workflow enables simple, repeatable, and efficient initiation of code generation. The code generation workflow supports many different data types, including variable-size data and global data. The workflow also supports multiple entry-point (top-level) functions, multisignature MEX function generation, and customization of fundamental properties such as the array layout and array indexing of the generated code. In addition, you can generate code that uses key C++ language features such as classes, namespaces, and function overloading.
应用
职能
对象
话题
生成代码基础
- 代码生成工作流程
从MATLAB代码生成C/C ++代码。 - 使用MATLAB编码器应用程序生成C代码
Generate C/C++ code from MATLAB code by using theMATLAB编码器应用程序。 - 在命令行中生成C代码
Generate C/C++ code from MATLAB code by using the代码根
命令。 - C++ Code Generation
了解特定于C ++的代码生成注意事项。 - 设置MATLAB编码器项目
在MATLAB编码器应用程序。
Switch Between Command Line and Project Workflows
- 将CodeGen命令转换为等效MATLAB编码器项目
使用代码根
命令-项目
option. - Convert MATLAB Coder Project to MATLAB Script
Generate code at the command line by using project settings. - 共享构建配置设置
Export project settings to a code generation configuration object or import the settings into a project.
特定于数据的工作流程
- 生成可变大小数据的代码
Generate code for data whose size might change at run time. - 为全局数据生成代码
从MATLAB代码中生成C/C ++代码,该代码使用全局数据 - 生成枚举的代码
从使用枚举的MATLAB代码中生成代码。
Extended Functionality
- 生成多个入口点功能的代码
Generate C/C++ code for multiple entry-point functions. - 为多个签名生成一个MEX功能
为多个签名生成一个MEX功能。 - Pass an Entry-Point Function Output as an Input
简化多个入口点功能的输入类型规范。 - 生成使用Row-Major数组布局的代码
生成C / c++代码行元素存储孔蒂guously in memory. - Generate Code That Uses N-Dimensional Indexing
在生成的代码中保留数组尺寸。
扩展的C ++功能
- Generate C++ Code with Class Interface
生成包装成类的C ++代码。 - 为MATLAB类生成C ++类
在MATLAB代码中为值类,句柄类或System Object™生成C ++类。 - 在生成的功能接口中使用动态分配的C ++数组
从生成的C ++函数接口中了解和使用动态分配的数组。 - 将生成的C ++代码组织到名称空间
名称空间将生成的代码组织到逻辑零件中,并防止名称碰撞。
代码外观
- 保留的关键字
Certain words in your code, that are C/C++ keywords, might be renamed in the generated code.