Determine if function is suitable for code generation
the entry-point MATLAB® function,
identifies unsupported functions and language features as code generation
compliance issues. It displays the code generation compliance issues
in a report. If
fcn calls other functions directly
or indirectly that are not MathWorks® functions,
these functions. It does not analyze MathWorks functions.
It is possible that
coder.screener does not detect
all code generation issues. Under
certain circumstances, it is possible that
entry-point functions (
Name of entry-point MATLAB function that you want to analyze. Specify as a character vector or a string scalar.
Comma-separated list of names of entry-point MATLAB functions that you want to analyze. Specify as character vectors or string scalars.
identifies calls to functions that are not supported for code generation.
It checks both the entry-point function,
and the function
Analyze the MATLAB function
function out = foo1(in) out = foo2(in); disp(out); end
function out = foo2(in) out = eval(in); end
The code generation readiness report displays a summary of the
unsupported MATLAB function calls. The function
one unsupported MATLAB function.
In the report, click the Code Structure tab and select the Show MATLAB functions check box.
This tab displays a pie chart showing the relative size of each file and how suitable each file is for code generation. In this case, the report:
foo1.m green to indicate
that it is suitable for code generation.
foo2.m yellow to indicate
that it requires significant changes.
foo1.m a code generation
readiness score of 4 and
foo2.m a score of 3. The
score is based on a scale of 1–5. 1 indicates that significant
changes are required; 5 indicates that the code generation readiness
tool does not detect issues.
Displays a call tree.
The report Summary tab indicates
foo2.m contains one call to the
which code generation does not support. To generate a MEX function
foo2.m, modify the code to make the call to
function out = foo2(in) coder.extrinsic('eval'); out = eval(in); end
Rerun the code generation readiness tool.
The report no longer flags
that code generation does not support the
When you generate a MEX function for
code generator dispatches
eval to MATLAB for
execution. For standalone code generation, the code generator does
not generate code for
identifies MATLAB data types that code generation does not support.
Analyze the MATLAB function
contains a MATLAB table.
function outTable = myfun1(A) outTable = table(A); end
The code generation readiness report indicates that table data types are not supported for code generation.
The report assigns
myfun1 a code readiness
3. Before generating code, you must fix
the reported issues.
fix issues that the Code Analyzer identifies.
Before generating code, use
check that a function is suitable for code generation. Fix all
the issues that it detects.