Why do I get warnings about a 'Variants' argument in Simulink R2022b and later?
36 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 19 Jan 2023
Modifié(e) : MathWorks Support Team
le 8 Fév 2024
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?
Réponse acceptée
MathWorks Support Team
le 8 Fév 2024
Modifié(e) : MathWorks Support Team
le 8 Fév 2024
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!