coder.extrinsic
R2026bDeclare extrinsic function
Syntax
Description
coder.extrinsic( declares that
function)function is extrinsic. The code generator does not produce code for
extrinsic functions. During MEX generation and MATLAB Function (Simulink) block simulation, the code generator executes extrinsic
function calls in MATLAB®. Because the code generator elides extrinsic function calls during
standalone code generation, code generation fails if the generated code depends on the
output of the extrinsic function. The run-time output of an extrinsic function is an
mxArray. To learn more about extrinsic functions, see Using Extrinsic Functions.
coder.extrinsic(function1,...,functionN) declares
function1 through functionN as extrinsic
functions.
coder.extrinsic(
specifies whether to synchronize global data between your MATLAB code and the generated MEX file before and after the extrinsic function
call. By default, the code generator synchronizes global variables before and after
extrinsic function calls. To learn how to change this default behavior, see Generate Code for Global Variables.syn,function1,...,functionN)
Examples
Input Arguments
Limitations
You cannot use
coder.cevalto call an extrinsic function.You cannot call local or nested functions extrinsically.
You cannot call MATLAB functions that inspect the caller or that read or write to the caller workspace extrinsically, including:
MATLAB Function block simulation or MEX function execution can produce unpredictable results if an extrinsic function:
Changes the working folder
Changes the MATLAB path
Deletes or adds MATLAB files
Changes warning states
Changes MATLAB preferences
Changes Simulink® parameters
You cannot pass values into or out of an extrinsic function that are or contain:
Handle classes
Function handles
Variables declared by using
coder.opaque
You can call extrinsic functions with up to 64 inputs and 64 outputs.
When you simulate a MATLAB Function block in rapid accelerator mode, the code generator omits extrinsic calls. If an extrinsic call affects block outputs, the rapid accelerator simulation fails.
Tips
When you declare a function extrinsic by using
coder.extrinsic, the code generator treats all calls to that function within the current function scope as extrinsic. To specify that a single function call is extrinsic, usefeval.
Extended Capabilities
Version History
Introduced in R2011a