Variant Parameters
With variant parameters in Simulink®, you can represent value variations of a system in a single model. You can group different sets of values based on the variant to simulate. You can activate each set of values depending on the variant control. You can incorporate variant parameters in any Simulink block. For more information, see What Are Variants and When to Use Them.
You can use Variant Manager for Simulink to manage variant parameters in your model.
The code that you generate for variant parameters can contain all the possible values of a system. You can switch between the values prior to code compile or at model startup as described in Activate Variant During Different Stages of Simulation and Code Generation Workflow.
Topics
- 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.
- Compile Code Conditionally for All Values of Variant Parameters with Same and Different Dimensions
This example shows how to generate a C code that contains all the active and inactive values of variant parameters.
- 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.
- 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
- Group Variant Parameter Values and Conditionally Switch Active Value Sets in Generated Code
Learn how to use variant parameter banks to group variant parameters in generated code.