How to find the variables of simulink non-active variants subsystem

조회 수: 5 (최근 30일)
Lev Vitkin
Lev Vitkin 2019년 11월 13일
답변: Lev Vitkin 2019년 11월 18일
I need fine if the my variable is used in Simulink model's non-active Variant subsystems.
The command Simulink.findVars returns me the data only from the active Variant subsystems of the model. That command compiles the model in an order to generate the list of varaibles used in the model/subsystems. I cannot just programattically activate the non-active Variant subsystem and run this command again. That is because that new-activated variant subsystem requires the use of different data dictionary (in my case) and won't compile with the current data dictionary.
Any ideas, please?

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2019년 11월 13일
from doc Simulink.findVars
Simulink.findVars discovers variable usage in inactive subsystem variants only if you select Analyze all choices during update diagram and generate preprocessor conditionals in the Variant Subsystem block dialog box. If you do not select this check box, the function does not discover variable usage in inactive variants.
  댓글 수: 2
Lev Vitkin
Lev Vitkin 2019년 11월 18일
..and this is a problem with the use of Simulink.findVars. I cannot select the option 'Analyze all choices" because in this case Simulink.findVars tries to compile all variant subsystems. And that won't work "because that new-activated variant subsystem requires the use of different data dictionary (in my case) and won't compile with the current data dictionary."
Lev
Fangjun Jiang
Fangjun Jiang 2019년 11월 18일
How about using find_system() with 'Variants' as 'AllVariants'?

댓글을 달려면 로그인하십시오.


Lev Vitkin
Lev Vitkin 2019년 11월 18일
The benefits of Simulink.findVars is that it find all objects of the model. Using find_system needs to specify the type ofthe object: const, signal, bus, etc. I am currently using find_system to find the objects of not-active variants, but that is not the ideal solution.

카테고리

Help CenterFile Exchange에서 Component-Based Modeling에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by