MATLAB: Can a warning be displayed when dead code in removed from a Stateflow diagram or Embedded MATLAB block in Real-Time Workshop 7.3 (R2009a)

simulink coder

If I have dead code in my Embedded MATLAB block or Stateflow diagram and I generate code using Real-Time Workshop, the resultant C code does not contain this dead code since Real-Time Workshop will optimize it out. I may have missed that fact that I created dead code, and rather than having Real-Time Workshop optimize it out, I would rather that it notify me that I have dead code. How can I do this?

Best Answer

The ability to make Real-Time Workshop issue this warning is not available in R2009a. To check for dead code that may be removed from Embedded MATLAB, use M-Lint inside of the Embedded MATLAB block. To check for dead code in a Stateflow diagram, simulate the model, and any inconsequential actions, transactions, or guard checks (i.e. dead code) will trigger a warning to the user upon simulation.
Related Question