MATLAB: Instrumentation Failure error when generating coverage report for model containing S-function

analysiscodecoverages-functionsimulinkSimulink Coveragesource

I'm using an S-function in my model and looking to generate a coverage report. When I proceed to generate the report, I see the following error message:
<S-function file name>: File not included in Coverage Analysis due to instrumentation failure
Why do I get this error?

Best Answer

In the S-function source code, you seem to declare a method without specifying a return type. The compiler used by the coverage report has more stringent checks than the one used to build the S-function, thus resulting in the coverage analysis failing to include the S-function in the report.
In general, for users encountering a similar error when attempting to include S-functions in the coverage report, please verify the source code and ensures it is free of syntax and compiler errors.