Why do I get the error "Unable to access the enumeration constant" in Stateflow R2019a?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 29 Jul 2019
Answered: MathWorks Support Team
on 29 Jul 2019
I have a model containing a Stateflow chart, which uses the enumerated type "BasicColors" in a local Stateflow variable with the same name. The enumerated type is defined in a data dictionary.
The model works fine in R2018b. However, when I tried to run the model in R2019a, I got the error:
Unable to access the enumeration constant 'Red' from a variable. Use the enumeration name: 'BasicColors.Red'.
Transition < '[Basic...action}'
>"BasicColors"
The error message is referring to the following statement in a transition condition:
BasicColors == BasicColors.Red
Accepted Answer
MathWorks Support Team
on 29 Jul 2019
Starting in R2019a, Stateflow will error out when there is a name confict between a local variable name and enum type class identifier.
To distinguish the "BasicColors" variable from the "BasicColors" enumeration, rename the local Stateflow variable to a name that is different from the enum class identifier (for example "MyBasicColor"). The according transition statement will be:
MyBasicColor == BasicColors.Red
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!