Breaking the links of ONLY the selected variants in Simulink
6 ビュー (過去 30 日間)
古いコメントを表示
Hello
I have a simulink model with a lot of subsystems that contains Variants subsystems in different locations in the model.
I want o break the links of only the Variants chosen in the simulation and save the model to share without sharing the whole libraries with it.
Breaking all the links using : save_system('Mymodel.slx','export.mdl','BreakALLLinks',true)
Takes a lot of time and doesnt work if it cant find a link to a library even if its not used
I was thinking about looking for scanning the model and get the variants that are chosen and then broke only these variants but i cant find the right commands.
Could you please help me with this issue ?
Thank you
0 件のコメント
回答 (1 件)
Sreeram
2025 年 6 月 4 日
Hi Ayyoub,
The following commands might help:
1. To find variant blocks that are active in simulation after model compilation:
set_param(model,'SimulationCommand','update');
blks = find_system(model,'MatchFilter',@Simulink.match.activeVariants)
You can find an example and more information in the documentation here:
2. To break a link to the library
set_param(blk,'LinkStatus','none')
The "LinkStatus" parameter provides information about the connection between a referenced block in a model and its corresponding block in a library.
For more information, refer to the documentation here:
https://www.mathworks.com/help/simulink/ug/control-linked-block-status-programmatically.html#bu_o6ta
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Component-Based Modeling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!