MATLAB Compiler    

Optimizing Conditionals

(optimize_conditionals) This optimization reduces the MATLAB conditional operators to scalar C conditional operators when both operands are known to be integer scalars. The Compiler "knows" that nargin, nargout, and for loop control variables (when using the above optimization) are integer scalars. For example,

If you compile this with the -O none option, you get

Compiling with -O none -O optimize_conditionals:on gives


 Loop Simplification Reference