MATLAB: How to list values of the Simulink Enumeration definitions

data dictionarysimulink

So I am trying to write a script to parse the .sldd format of simulink data dictionary.
I need to get all the possible values of an enumeration type as string.
I can list enum type definitions by:
enumTypeDefs = find(sectionObj, '-value','-class','Simulink.data.dictionary.EnumTypeDefinition')
This returns an array of Entry ebjects.
After this command when I run
getValue(enumTypeDefs(1))
It returns and displays values as part of Simulink.data.dictionary.EnumTypeDefinition class object.
I took a look at the documentation and saw that there isn't a property or method that returns all the values, you can return default value etc. but not all of them. https://nl.mathworks.com/help/simulink/slref/simulink.data.dictionary.enumtypedefinition-class.html
Also there isn't a method to return the number of elements in the enumeration type, this makes me unable to iterate over and return values one by one since I don't know the boundry of the iteration index.
I'd be glad If someone helped.
Thanks.

Best Answer

I don't know if it's still an open Q, but since i found it while looking for the same thing, here's how I did it.
Once you have the Entry objects, get their Value with getValue, this/these will be EnumTypedefinition object(s).
Then one of the properties of an EnumTypeDefinition object is "Enumerals", hence:
enumDefList = <enumTypeDefObject>.Enumerals
will return a structure array holding Name, Value and Description of the enumerated type.
I'm using 2020a at the moment.