Replace current MATLAB function implementation with code replacement library function in generated code
coder.replace(
replaces
the current function implementation with a code replacement library function. ifNoReplacement
)
During code generation, when you call coder.replace
in a
MATLAB® function, the code generator performs a code replacement library lookup for
the function signature:
[y1_type, y2_type,..., yn_type]=fcn(x1_type, x2_type,...,xn_type)
x1_type, x2_type,...,xn_type
and the output types,
derived from the implementation, are y1_type, y2_type,..., yn_type
. If a
match for the MATLAB function is found in a registered code replacement library, the contents of
the MATLAB function are discarded and replaced with a call to the code replacement library
function. If a match is not found, the code generates without replacement. coder.replace
only affects code generation and does not alter
MATLAB code or MEX function generation. coder.replace
is
intended to replace a MATLAB function that has behavior equivalent to its replacement
function implementation. If the MATLAB function body is empty or not equivalent to the
replacement function implementation, it may be eliminated from the generated code. The
MATLAB function prior to replacement is used for simulation. You are responsible for
verifying the numeric result of simulation and code generation after replacement.
coder.replace
requires an Embedded Coder® license.
coder.replace
is a code generation function and does not alter
MATLAB code or MEX function generation.
coder.replace
is not intended to be called multiple times within
a function.
coder.replace
is not intended to be used within conditional
expressions and loops.
coder.replace
does not support saturation and rounding modes
during code replacement library lookups.
coder.replace
does not support
varargout
.
coder.replace
does not support function replacement that requires
data alignment.
coder.replace
does not support function replacement of MATLAB
functions with variable-size inputs.