| Contents | Index |
To generate preprocessor conditionals, the types of blocks that you can place within the child subsystems of a Variant Subsystem block are limited. Connections are not allowed in the Variant Subsystem block diagram. However, during the code generation process, one Merge block is placed at the input of each Outport block within the Variant Subsystem block diagram. All of the child subsystems connect to each of the Merge blocks.
In the following example, the code generation process makes the following connections and adds Merge blocks to the sldemo_variant_subsystems.

The restrictions placed on Merge blocks apply to the contents of the Variant Subsystem blocks. Furthermore, variant subsystems cannot contain continuous states. The restriction checks are performed only when generating code. In addition, the child subsystems of the Variant Subsystem block must be atomic subsystems. In the Subsystem block parameters dialog box, select the Treat as atomic unit parameter.
![]() | Generate Code for Variant Subsystems | Special Considerations for Generating Preprocessor Conditionals | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |