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

classenumerationfunctionMATLABobjectsimulinksupported

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?

Best Answer

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.