Why do I get warnings about a 'Variants' argument in Simulink R2022b and later?
40 ビュー (過去 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!