Trouble with Simulink enumerated type in data dictionary

13 views (last 30 days)
Hi everyone,
I’m using MATLAB 2023b, and I’m encountering an issue when using Simulink enumerated types in the data dictionary. Sometimes it raises an error, as shown in the picture below.
I have already created the enum typedef in the data dictionary, and I also defined a similar new enum typedef called PROPEL_HILL_STATE_E, which does not raise any errors. The only difference I noticed is that other enum typedefs are being used in other models except PROPEL_HILL_STATE_E.
I don’t want to use class declarations in .m files, since my goal is to generate code directly from the models I’m developing. Can anyone please help to fix this issue and I also attached snap of my data dictionary.
Thanks in advance
Adithya
  1 Comment
Mark McBroom
Mark McBroom on 18 Sep 2025
I assume you have attached the enum_typedef data dictionary to your Simulink model?

Sign in to comment.

Answers (1)

Vedant Shah
Vedant Shah on 26 Sep 2025
The error “Variable PROPEL_SWITCH_PROPEL_DIRECTION_E does not exist” often happens when the Simulink model isn’t properly linked to the data dictionary that defines the enumerated type. Follow the below steps to resolve it:
  • In Simulink, open your model and navigate toFile > Model Properties > External Data > Data Dictionary. Check the data dictionary linked to the model.
  • Open the linked dictionary in the Dictionary Editor and in the Referenced Dictionaries section, add other dictionaries like “PROPEL_SWITCH_PROPEL_DIRECTION_E that define enums or variables the model needs and save that.
Now, the error will not occur and the model would be able to access the members form the referenced dicitonaries as well.
For more information refer to the following documentation:

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!