How to get enumerations defined by Simulink.IntEnumType to appear in data assistant?
    7 views (last 30 days)
  
       Show older comments
    
    Brent Jarvis
 on 12 Apr 2023
  
    
    
    
    
    Commented: Brent Jarvis
 on 21 Apr 2023
            Hi, 
I have various classdef EMyEnum < Simulink.IntEnumType m-files which all work fine except that they do not autopopulate in the data assisstant drop down. If I enter Enum: EMyEnum it comes in fine, but the drop down doesn't list the enums that are defined in my m-files only the enums defined in a data dictionary. Is there a way to get the ModelExplorer and Simulink to display enumerations defined like this? 
For instance EDriveState is defined in an M-file (see below). This comes in fine when typed but its not suggested as an option by the data type assistant. The 2 Enums which do show up are in the data dictionary. 

classdef EDriveState < Simulink.IntEnumType
    enumeration
        STOPPED 	(1)  	 % The drive is not running, but is ready to start.
        PRE_START 	(2)  	 % The drive is not yet running, but actions are being taken to prepare to start.
        STARTING 	(3)  	 % The drive is starting.
        WARM_UP 	(4)  	 % The drive is operating at reduced speed or load to allow correct operating temperature to be reached.
        RUNNING 	(5)  	 % The drive is running in steady state operation and can be loaded.
        COOL_DOWN 	(6)  	 % The drive is operating at reduced speed or load to allow the operating temperature to drop before stopping.
        STOPPING 	(7)  	 % The drive is stopping.
        POST_RUN 	(8)  	 % The drive is not turning, but actions are being taken to complete the shutdown sequence.
        ERROR 	(9)  	 % An error has occurred and the drive is unavailable.
    end
    methods (Static)
   	 function retVal = getDescription()
         retVal = 'Abstract super states, possible Drive States.  Specific drive states can be mapped to these states.';
     end
     function retVal = getDefaultValue()
         retVal = EDriveState.STOPPED;
     end
    end
end
0 Comments
Accepted Answer
  Manoj Mirge
    
 on 21 Apr 2023
        Hi Brent, 
If you want the Model Explorer and Simulink to display enumerated data types defined by you, you will need to store them in Simulink data dictionary. 
You can refer below link for storing your custom enumerated data types into Simulink data dictionary: 
Hope this helps. 
More Answers (0)
See Also
Categories
				Find more on Simulink Environment Customization in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
