The errors that you are getting are actually expected behavior, and are due to the changes in Simulink introduced in R2012a. Refer to the release notes for more information:
This is why you are getting an error:
In your Enumeration definition file, you have included a function ‘getHeaderFile()’. This particular function, in the context of a Simulink model, is more important for code generation (C files, MEX files etc.) than it is for the actual simulation purposes. When you run a simple Simulink model that does not contain any Stateflow charts (such as the file ‘mdl_01.mdl’), Simulink ignores the function ‘getHeaderFile()’, as the complete definition of you Enumeration data-type has already been given in the first part of the definition file. No code generation is required to run this simple model, so it runs smoothly.
In files that have Stateflow models in them, the ‘getHeaderFile()’ function suddenly relevant. How Stateflow models work is that a C program is first generated from the chart which is then converted into a MATLAB executable file (a MEX file). The MEX file is then embedded in the Model, and the C files are deleted. For the C files to work properly, either Simulink must make or the user must provide a functional header for the Enumeration data-type.
In case your Enumeration definition file does not have the function ‘getHeaderFile()’ in it, or if the string returned by the ‘getHeaderFile()’ function is empty, the CODER will generate its own header file for this particular enumeration data type. This CODER-generated header will in most cases work perfectly if the Enum definition is well written.
I suggest that you remove the ‘getHeaderFiles()’ function entirely, as you are not really using the externally defined header in your code. If you do this the Stateflow model will know that it would have to make its own header, and while this may make your program slightly slower, it will run error free.
Best Answer