Function Definition - MATLAB & Simulink (original) (raw)

Main Content

Defining and calling functions for code generation

There are special considerations when you create MATLABĀ® functions that are intended for code generation. These include certain restrictions when you use varargin andvarargout, recursive functions, anonymous functions, and nested functions. To generate code for MATLAB recursive functions, the code generator uses either compile-time recursion or run-time recursion. To produce efficient C/C++ code, the code generator sometimes creates multiple versions of a function, referred to as function specializations. In certain cases, you can prevent the code generator from creating function specializations by using coder.ignoreSize and coder.ignoreConst. While generating a MEX function, you can bypass code generation for a specific function in your MATLAB code and instead use the MATLAB engine to execute the call. To do this, use the coder.extrinsic construct.

Functions

Topics

Troubleshooting