Why do I get an error about supported enumerations when instantiating a MATLAB Object in a Matlab Function block in Simulink 7.8 (R2011b)?

3 views (last 30 days)
I created a class 'myClass' in MATLAB, which works fine from the MATLAB Command Window. I then made a Simulink model with a MATLAB Function block that instantiates an object of type 'myClass'. When I generate code from this block, I receive the following error:
'myClass' is not a supported enumeration. For code generation, enumerations must inherit from 'int32' or 'Simulink.IntEnumType'.
Function 'MATLAB Function' (#18.28.35), line 4, column 5: "myClass"
Where does the enumeration issue come in, and how can I resolve it?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Nov 2012
Support for MATLAB Objects in MATLAB Function blocks was added in Simulink 7.9 (R2012a). The release notes show more details about this:
<http://www.mathworks.com/help/releases/R2012a/toolbox/simulink/rn/bs8esk9.html#bs8esz2>
In older versions, the error about enumerations stems from the fact that Simulink sees the class constructor as an enumerated data type, but cannot correctly resolve it as it is a MATLAB Object. There are no workarounds.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2011b

Community Treasure Hunt

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

Start Hunting!