The error messages indicate that the S-function code might not be in line with the level-1 C-MEX S-function template. An example is attached to this solution which shows a simple level-1 S-function. The level-1 C-MEX S-function template is also attached.
Note that MathWorks does not recommend creating new level-1 C-MEX S-functions, although compatibility for these still exists in current Simulink versions. It is recommended to use the level-2 C-MEX S-function interface whenever you create a new C-MEX S-function. The Level-1 S-function API is preserved only for backward compatibility with previous versions of Simulink.
In case of an issue with your existing level-1 C-MEX S-function you
might want to consider converting your S-function to a level 2 C-MEX S-function. For further information please type the following line into your MATLAB Command Window:
docsearch 'Converting Level 1 C MEX S-Functions to Level 2'
Best Answer