Documentation

Function Definition

Defining and calling for code acceleration

Functions

coder.extrinsic Declare extrinsic function or functions

Examples and How To

Specify Variable Numbers of Arguments

Use varargin and varargout for code generation.

Apply Operations to a Variable Number of Arguments

Use varargin and varargout in for-loops.

Implement Wrapper Functions

Use varargin and varargout to pass a variable number of inputs to another function.

Call Local Functions

Call local functions in MATLAB® code that is intended for code generation.

Call Supported Toolbox Functions

Call toolbox functions that are supported for code generation.

Extrinsic Functions

Declare a function as extrinsic when code generation does not support that function.

Force Code Generator to Use Run-Time Recursion

Rewrite your MATLAB code so that the code generator uses run-time recursion instead of compile-time recursion.

Concepts

Supported Index Expressions

Index varargin and varargout in MATLAB code that is intended for code generation.

Variable Length Argument Lists for Code Generation

Adhere to code generation restrictions for varargin and varargout.

Resolution of Function Calls for Code Generation

The code generator uses precedence rules to resolve function calls.

Resolution of File Types on Code Generation Path

The code generator uses precedence rules to resolve file types.

Compilation Directive %#codegen

Indicate that a MATLAB function is intended for code generation.

Code Generation for Recursive Functions

Use recursive functions in MATLAB code that is intended for code generation.

Code Generation for Anonymous Functions

Use anonymous functions in MATLAB code intended for code generation.

Troubleshooting

Output Variable Must Be Assigned Before Run-Time Recursive Call

Troubleshoot output variable assignment for run-time recursion.

Compile-Time Recursion Limit Reached

Troubleshoot compile-time recursion limit error.

Was this topic helpful?