code to replace Variant subsystem in a simulink model with library of its active variant

1 回表示 (過去 30 日間)
Laila Rezai
Laila Rezai 2021 年 12 月 14 日
回答済み: Dinesh 2024 年 4 月 10 日
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!

回答 (1 件)

Dinesh
Dinesh 2024 年 4 月 10 日
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.

カテゴリ

Help Center および File ExchangeSubsystems についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by