Trouble with Simulink enumerated type in data dictionary

13 visualizaciones (últimos 30 días)
Adithya
Adithya el 15 de Sept. de 2025
Respondida: Vedant Shah el 26 de Sept. de 2025
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 comentario
Mark McBroom
Mark McBroom el 18 de Sept. de 2025
I assume you have attached the enum_typedef data dictionary to your Simulink model?

Iniciar sesión para comentar.

Respuestas (1)

Vedant Shah
Vedant Shah el 26 de Sept. de 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:

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by