Why do I get warnings about a 'Variants' argument in Simulink R2022b and later?
조회 수: 34 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2023년 1월 19일
편집: MathWorks Support Team
2024년 2월 8일
While working on my Simulink model in R2022b or later, I encounter the following warning:
Warning: Using find_system without the 'Variants' argument skips inactive Variant
Subsystem blocks in the search. This behavior will change in a future release to
look at all choices of the Variant Subsystem. To find blocks that are active in
simulation or code generation, compile the model and use the built-in variant
filters with the 'MatchFilter' option. To find all blocks use filter
'@Simulink.match.allVariants' with the 'MatchFilter' option.
Or warnings similar to the following:
Warning: 'Variants' will be removed. Instead of using 'Variants' with value set to
'AllVariants', use 'MatchFilter' with value set to '@Simulink.match.allVariants'.
Why is this happening and how can I turn these warnings off?
채택된 답변
MathWorks Support Team
2024년 2월 8일
편집: MathWorks Support Team
2024년 2월 8일
The warnings are caused by using the 'find_system' function, or related functions such as 'libinfo', on a model with Variant Subsystems in R2022b or later. The warnings are due to the 'Variants' argument of these functions being deprecated in a future release of MATLAB.
Refer to the "Version History" section of the 'find_system' documentation for detailed information regarding this change:https://www.mathworks.com/help/simulink/slref/find_system.html#mw_701aa577-b30f-4f10-bf9a-19be1eab185b
To find all blocks, use the filter '@Simulink.match.allVariants' with the 'MatchFilter' option. An example of this can be seen in the following code:
>> find_system(model, 'MatchFilter', @Simulink.match.allVariants);
To find only blocks that are active in simulation, compile the model and use the filter '@Simulink.match.activeVariants' with the 'MatchFilter' option:
>> set_param(model,'SimulationCommand','update');
>> find_system(model, 'MatchFilter', @Simulink.match.activeVariants);
See the "Find Variant Blocks Using Built-In Filter Functions" section for more details and examples:
1) If you would like to ignore these warnings and turn them off, then you can do so using the following commands:
>> warning('off','Simulink:Commands:FindSystemDefaultVariantsOptionWithVariantModel')
>> warning('off','Simulink:Commands:FindSystemAllVariantsRemoval')
>> warning('off','Simulink:Commands:FindSystemVariantsOptionRemoval')
2) If you are unsure where there is a call to 'find_system' or 'libinfo' in your environment or project, you can use the command:
>> lastwarn
and inspect the warning stack or send it to MathWorks Technical Support. In case the warning stack points to third-party toolboxes or environments, reach out to the support teams for these external products.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!