After creating an 'Embedded Matlab function' block in version 2010a, then opening it in 2011a, saving it and reopening in 2010a, I get the following error when simulating the simulink model. This error is severe enough to crash matlab.
Error occurred in 'blah'. Error occurred while attempting to call the error callback function 'Stateflow.Translate.translate' of subsystem 'blah/Embedded MATLAB Function'. The callback function should take a block handle and error ID as input arguments, and return a string that replaces the error produced within the
subsystem. The following error was produced when the error callback function was called: Undefined function or method 'Stateflow.Translate.translate' for input arguments of type 'double'.
After a tip from
http://www.gomatlab.de/hilfe-zur-fehlermeldung-t20311.html to set the 'Name of error callback function:' under 'subsystem parameters' to empty I then got a new error
Embedded MATLAB Interface Error: Error using ==> feval Invalid MEX-file 'blah.mexa64: undefined symbol: emlrtCheckBuiltInCtxR2011a.
I assumed this means that the block was compiled to mex code in R2011a, and is now somehow incompatible. I tried making trivial changes to the code in the block, to force it to recompile, but no dice. Even deleting the block and replacing it with an entirely new block (i.e. y=u) gives the same error.
Models which I didn't open in R2011a still work with Emulated Matlab Functions inside them. The simulink blocks can even be copy-pasted from one to the other.
So does anybody have any ideas of how to make Emulated Matlab Functions work in this simulink model again?