Variant errors when upgrading the MATLAB release

28 views (last 30 days)
I have upgraded my Simulink models to the latest release. When I simulate the upgraded models, the following errors show up:
Variant control '<object name>' of variant block '<block name>' must be a condition expression or name of a Simulink.Variant object in the global scope workspace of the model. Ensure that the condition does not match the model name.
Error evaluating properties of Simulink.Variant object '<object name>' in workspace 'base' (used by block '<block name>')
Caused by: The variant condition <conditions> on the block '<block name> originate from different workspaces. This is not a supported workflow.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Oct 2024
Edited: MathWorks Support Team on 21 Oct 2024
The causes of the errors and their corresponding resolutions are as follows:
  1. As of R2020b/R2021a, the variables used in the variant conditions need to be from the same workspace. For example, Simulink does not support a variant block with condition ‘A==1 && B == 1’, where the variable ‘A’ is from the base workspace and the variable ‘B’ is from the mask workspace. As a resolution, please make sure that, for each of your variant conditions, the variant control variables belong to the same workspace.
  2. As of R2020b, the models cannot have duplicate variant control variables in the base workspace and a mask workspace. Otherwise, an error will show up. For example, if there is a variable ‘A’ in the base workspace that is being used in a variant control condition, then, there cannot be a variable ‘A’ in a mask workspace that is used in some other variant control condition. The vice-versa of this scenario also applies. To resolve this issue, please make sure that the variant control variables have unique names.
These two issues have also been described in the following documentation:

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!