Excluding Unused Paths from Generated Code - MATLAB & Simulink (original) (raw)

Main Content

In certain situations, you do not need some branches of an: if, elseif, else statement, or a switch, case, otherwise statement in your generated code. For instance:

You can prevent code generation for the unused branches of an if/elseif/else statement or a switch/case/otherwise statement. Declare the control-flow variable as a constant. The code generator produces code only for the branch that the control-flow variable chooses.