Simulink variant subsystems: How to read subsystem parameters by commandline

3 ビュー (過去 30 日間)
Carsten
Carsten 2013 年 3 月 26 日
Dear community members,
as configurable subsystems are not longer supported I decided to switch to variant subsystems. My aim is to have a converter which automatically changes cs into vs. For this reason I need to do all necessary steps by commandline.
I tried to read the subsystem parameters of a variant subsystem I created. All I got was 'ActiveVariant' and similar things but I didn't manage to read the "Variant Choices" table which contains the connection between Name, Variant Object and Condition. By searching the Simulink documentation I found the parameter 'Variants' which seems to contain that information. My problem is that for the variant subsystem I have in hand this property doesn't exist. For
get_param('test_variant', 'Variants');
I get the error message
??? SubSystem block does not have a parameter named 'Variants'.
I am using Matlab 2010b SP1. Is there a possibility to read the "Variant Choices" information?
Thanks in advance, Bettina

採用された回答

Carsten
Carsten 2013 年 3 月 27 日
I found it. Every member of the variant subsystem has a property which specifies the variant object to this member block. It is readable
get_param('Test2/Variant Subsystem/Subsystem', 'VariantObject');
and writeable
set_param('Test2/Variant Subsystem/Subsystem', 'VariantObject', 'VO_Subsystem');

その他の回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2013 年 3 月 27 日
I believe the way to do this is to use FIND_SYSTEM on the Variant Subsystem with a 'SearchDepth' of '1' option to get all the variant options under it. You can then get the variant object of each of those subsystem choices by getting the 'VariantObject' property.
  1 件のコメント
Carsten
Carsten 2013 年 3 月 27 日
Thanks for your help. Unfortunately I still marked my own answer as accepted. The next time it will be yours, I promise ;-)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeComponent-Based Modeling についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by