Clear Filters
Clear Filters

How to get enumerations defined by Simulink.IntEnumType to appear in data assistant?

7 views (last 30 days)
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

Accepted Answer

Manoj Mirge
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.
  1 Comment
Brent Jarvis
Brent Jarvis on 21 Apr 2023
Daaang ok, I liked the m-files since it makes diff-ing for source control a little easier as well as running tests on subsystem references. I'll just deal with this inconvience for now, maybe we'll switch to data dictionaries.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!