本页面提供的是上一版软件的文档。当前版本中已删除对应的英文页面。
变体系统
为变体模块、符号维度和参数变体生成代码
为包含变体模块、变体参数或使用符号维度的模型生成具有预处理器条件句的代码。对于变体模块和参数,预处理器条件句将选择活动变体的时间推迟到编译时,或者不允许使用活动变体选择项。对于符号维度,预处理器条件句定义仿真期间在符号之间建立的约束。
主题
变体模块
- 使用变体模型生成使用 C 预处理器条件句的代码
此示例说明如何使用模型变体生成使用预处理器条件句的代码,以控制哪些代码链接到嵌入式可执行文件中。
变体参数
- Options to Represent Variant Parameters in Generated Code
You can generate the code only for active values or for both active and inactive values of variant parameters in Simulink®. - Improve Code Readability of Variant Parameters Using Enumerated Types
You can use enumerated types to improve code readability of variant control values in variant parameters. - Reuse Variant Parameter Values from Handwritten Code Using Simulink.Parameter Variables
This example shows how to use
variables to generate a code that imports variant parameter values from your existing code.Simulink.Parameter
- Run Executable for Different Variant Parameter Values Without Recompiling Code
This example shows how to generate an executable that runs for different set of variant parameter values without needing to recompile the code for each set of values.
符号维度
- Implement Symbolic Dimensions for Array Sizes in Generated Code
Specify dimension information as symbols in blocks and data objects. These symbols propagate throughout the model during simulation and then go into the generated code. - Configure Symbolic Dimensions for S-Function Blocks
Configure S-functions to support forward propagation, backward propagation, or forward and backward propagation of symbolic dimensions during simulation. - Generate Code for Variant Subsystem with Child Subsystems of Different Output Signal Dimensions
This example shows how to use symbolic dimensions to generate code for a variant subsystem consisting of child subsystems of different output signal dimensions.