生成代码接口
使用 C API 接口和代码描述符接口在生成的代码和外部应用程序代码之间交换数据
一些应用程序必须在生成的代码和外部应用程序代码之间交换数据。使用 MATLAB 代码描述符 API 获取有关生成代码的元数据。使用 C API 在运行时与生成的代码对接,并在目标平台上执行模型代码期间监控并调节模型元素。
Sample Target Environment Service Implementations of Data Communication Methods 显示目标环境服务如何实现三种类型的数据通信方法的示例:直接访问、执行期外和执行期间。
类
函数
主题
配置生成代码中的数据类型
- Parameter Data Types in the Generated Code
Optimize the generated code and generate code for specific processors by controlling the data types that store parameter data in computer memory. - 在生成的代码中创建可调标定参数
在生成的代码中创建可在快速原型和标定过程中访问的可调参数数据。
C API 接口
- Get Started with C API
Learn the principles of using C API to interact with the generated model code.
- Configure Model to Generate C API Code
Learn how to configure your model to include different types of C API elements in the generated code.
- Write External Code to Access Generated C API Code
Learn how to write external code that can access generated C API code elements.
- Use C API to Monitor and Tune Generated Model Code
Learn the details about how to use the C API to monitor and tune model elements.
- 步骤 1: Explore Measurable and Tunable Model Elements
- 步骤 2: Configure Model to Add C API Signals in Code Generation
- 步骤 3: Write Code to Interact with Generated C API Signal Code
- 步骤 4: Interact with C API Signal Code Throughout Execution
- 步骤 5: Write Code to Interact with Generated C API Signal and Parameter Code
- 步骤 6: Use Custom Monitor to Measure and Tune Model Elements in Real Time
代码描述符接口
- Get Code Description of Generated Code
Obtain metadata about the generated code. - Get Generated Type and Name of Inport Structures
Obtain metadata about the inport structures in generated code. - Get Metadata About Service Interface
Obtain metadata about the generated service interface by using the code descriptor programming interface. - Get Metadata About Test Points and Logged Signals in Generated Code
Retrieve metadata for test points and logged signals in generated code.