Function Handle Definition for Code Generation

You can use function handles to invoke functions indirectly and parameterize operations that you repeat frequently. You can perform the following operations with function handles:

  • Define handles that reference user-defined functions and built-in functions supported for code generation (see Functions and Objects Supported for C and C++ Code Generation — Alphabetical List)

      Note:   You cannot define handles that reference extrinsic MATLAB® functions.

  • Define function handles as scalar values

  • Define structures that contain function handles

  • Pass function handles as arguments to other functions (excluding extrinsic functions)

To generate efficient standalone code for enumerated data, you are restricted to using a subset of the operations you can perform with function handles in MATLAB, as described in Function Handle Limitations for Code Generation

Was this topic helpful?