Trouble with Simulink enumerated type in data dictionary
조회 수: 16 (최근 30일)
이전 댓글 표시
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
Mark McBroom
2025년 9월 18일
I assume you have attached the enum_typedef data dictionary to your Simulink model?
답변 (1개)
Vedant Shah
2025년 9월 26일
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 to File > 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:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!