You have a MATLAB® function that performs multiple tasks determined by a control-flow variable. You might not need some of the tasks in the code generated from this function.
You have an
in a MATLAB function performing different tasks based on the
nature (type/value) of the input. In some cases, you know the nature
of the input beforehand. If so, you do not need some branches of the
You can prevent code generation for the unused branches of an
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.