Why do I get warnings about a 'Variants' argument in Simulink R2022b and later?
40 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 19 Jan. 2023
Bearbeitet: MathWorks Support Team
am 8 Feb. 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?
Akzeptierte Antwort
MathWorks Support Team
am 8 Feb. 2024
Bearbeitet: MathWorks Support Team
am 8 Feb. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!