MATLAB Answers

How do I list values of the Simulink Enumeration definitions ?

62 views (last 30 days)
Ozan Yüksel
Ozan Yüksel on 2 Apr 2019
Answered: Amjad Elshenawy on 23 May 2019
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.

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by