How format external data for an inport with enum data type defined in data dictionary in Simulink?
Show older comments
Hi
I came across this new challenge and I have not been able to solve it, I hope you can help me, thanks in advance for your help!!
I have a simulink model that has an input defined with an Enum data type (for example "weekdays"), the definition of the enum class is stored in a data dictionary and the model runs without problems.
Also I have a vector of data in an excel sheet (for example ['Monday'; 'Tuesday'; ...]), which serve as inputs to the model, I import the data as a string and import the enum definition to matlab, I converted the data to 'int16' that is the same storage type that the enum class has in the data dictionary definition, the problem is that when I try to execute the model it tells me that my type data is incorrect
Error type 'int16' expected 'Enum wekdays'
I am using simulink.signal and dataset (inherent time series) to to supply the data to the model, my next test is to define the enum class in matlab and try to convert the data in matlab with the same enum type, but I feel like there must be a simpler solution
Accepted Answer
More Answers (1)
Fangjun Jiang
on 9 Nov 2021
0 votes
double click the Inport block, select the "Signal Attributes" tab, in "Data type', pick "Enum: <class name>" and specify your class.
1 Comment
Jorge Rojas
on 9 Nov 2021
Categories
Find more on Event Functions 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!