coder.replace
Replace current MATLAB function implementation with code replacement library function in generated code
Description
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
this 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 might 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.
Examples
Input Arguments
Tips
coder.replacerequires an Embedded Coder® license.coder.replaceis a code generation function and does not alter MATLAB code or MEX function generation.coder.replaceis not intended to be called multiple times within a function.coder.replaceis not intended to be used within conditional expressions and loops.coder.replacedoes not support saturation and rounding modes during code replacement library lookups.coder.replacedoes not supportvarargout.coder.replacedoes not support function replacement that requires data alignment.coder.replacedoes not support function replacement of MATLAB functions with variable-size inputs.
Extended Capabilities
Version History
Introduced in R2012b