MATLAB Answers

Why does changing a Subsystem Variant cause code regenerati​on/recompi​lation and are there any alternatives?

1 view (last 30 days)
Paul on 3 Mar 2015
When Subsystem Variants (and Model Reference) variants first arrived, it was apparent that changing the active variant would cause a recompile when running the Accelerator; see this thread here:
With 2014a I'm seeing the same behavior. Does anyone know why Variants are implemented this way, i.e., why can't the selection of the variant be done in the executable code instead of (what appears to be) by the pre-processor? (Same problem with the old Configurable Subsystem btw).
Nevertheless, that's the way it is. Until now, my approach has been to wrap each subsystem that I want to select from in an Enabled Subsystem, put them all in parallel, set the enabling input to each based on the variant selection criteria evaluated from user-defined parameters, and pipe all of the outputs into a Merge block. This worked fine until the other day, when I changed one of the subsystems and all of the sudden Simulink found a non-existent algebraic loop, which causes an error. It's been my experience that Simulink gets confused by Enabled Subsystems in this regard.
Is there another way to set up the model to be able to select the desired subsystem via a parameter at runtime without causing code regeneration or recompile?


Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!