Why aren't some functions supported for code generation with MATLAB Coder?
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 30 Sep 2025
Answered: MathWorks Support Team
on 22 Jan 2026 at 22:13
I'm trying to use the MATLAB Coder to generate C code from my MATLAB scripts and am seeing an error of the form
Function "<name>" is not supported for code generation
regarding certain built-in MATLAB functions. What does this error mean, and why isn't code generation supported for these functions?
Accepted Answer
MathWorks Support Team
on 30 Sep 2025
Some MATLAB functions are not supported for code generation. If you have would like to know whether a function you are using is supported for code generation, please check this complete list of the Functions and Objects Supported for C/C++ Code Generation in the latest release.
Generally speaking, there is no common component of the unsupported functions that causes them to be unsupported by MATLAB Coder. If you are interested in enabling code generation for a specific built-in function, you can use the web form to Request Code Generation Support for MATLAB Functions.
The following workarounds can be used when generating code for MATLAB code that uses unsupported functions:
1. The
function will allow you to call an external C or C++ function. This option will require you to either write your own C/C++ code or find an existing C/C++ function that accomplishes the task of the unsupported function.
2. There is also a coder.extrinsic function in MATLAB that allows you to declare the unsupported function as 'extrinsic'. With this option, the code generator produces code for the call to the extrinsic function but does not produce the function's internal code. Therefore, the 'coder.extrinsic' workaround requires that you have the MATLAB Runtime environment on the computer where you are planning to run the generated code.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!