MATLAB: Does the model, which contains a MinMax block, throw an error during code generation with Real-Time Workshop 5.1(R13SP1)

blockcodeerrorfailgen"minmaxsimulink coderwrong

For example, I receive the following error:
Error using ==> make_rtw
Error using ==> tlc_c (InvokeTLC)
Error: "MATHLIB: Call to function max requires two nonempty inputs."

Best Answer

This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
This has been verified as a bug in Real-Time Workshop 5.1 (R13SP1). Code generation can fail under certain conditions for the Relational Operator and MinMax blocks when expression folding is enabled and input to the Relational Operator block comes from a MinMax block.
Currently, to work around this issue, disable 'expression folding'.