code to replace Variant subsystem in a simulink model with library of its active variant
1 view (last 30 days)
Show older comments
Hello,
I have a simulink model which has 3 variant subsystems it is run pefectly but for long simulation I am facing with memory outage error. Because of that I want to wirte a code which autmatically replace each variant subsystem with library block of its selected active variant inorder to have a simpler and faster simulation model? Does someone has any writen function or code for this purpose?
Thanks in advance!
0 Comments
Answers (1)
Dinesh
on 10 Apr 2024
Hi Laila,
"Configurable Subsystem" was introduced earlier than "Variant Subsystem". As per my understanding, "Configurable Subsystem" replaces itself with the active choice completely, but "Variant Subsystem" doesn't. However, I wouldn't recommend using "Configurable Subsystem" because it will be deprecated in future versions. Here's the documentation link for the same: https://www.mathworks.com/help/simulink/slref/configurablesubsystem.html
I also have to point out that "Variant Subsystem" has undergone several improvements in the last few years and you might not face these memory issues with the latest release. You can use the "Update Diagram" option for the "Variant Activation Time" in the dialog for Variant Subsystem. This will ensure that only the active variants get compiled and executed. Here's the documentation link for the same: https://www.mathworks.com/help/simulink/slref/variantsubsystemvariantmodelvariantassemblysubsystem.html
I hope this helps.
0 Comments
See Also
Categories
Find more on Subsystems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!