This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Determine if function is suitable for code generation


coder.screener(fcn_1,...,fcn_n )


coder.screener(fcn) analyzes the entry-point MATLAB® function, fcn. It 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, coder.screener analyzes 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 coder.screener reports false errors.

coder.screener(fcn_1,...,fcn_n ) analyzes entry-point functions (fcn_1,...,fcn_n).

Input Arguments


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.


collapse all

The coder.screener function identifies calls to functions that are not supported for code generation. It checks both the entry-point function, foo1, and the function foo2 that foo1 calls.

Write the function foo2 and save it in the file foo2.m.

function out = foo2(in)
  out = eval(in);

Write the function foo1 that calls foo2. Save foo1 in the file foo1.m.

function out = foo1(in)
  out = foo2(in);

Analyze foo1.


The code generation readiness report displays a summary of the unsupported MATLAB function calls. The function foo2 calls 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:

  • Colors foo1.m green to indicate that it is suitable for code generation.

  • Colors foo2.m yellow to indicate that it requires significant changes.

  • Assigns 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 that foo2.m contains one call to the eval function, which code generation does not support. To generate a MEX function for foo2.m, modify the code to make the call to eval extrinsic.

function out = foo2(in)
  out = eval(in);

Rerun the code generation readiness tool.


The report no longer flags that code generation does not support the eval function. When you generate a MEX function for foo1, the code generator dispatches eval to MATLAB for execution. For standalone code generation, the code generator does not generate code for eval.

The coder.screener function identifies MATLAB data types that code generation does not support.

Write the function myfun that contains a MATLAB table.

function outTable = myfun1(A)
outTable = table(A);

Analyze myfun.


The code generation readiness report indicates that table data types are not supported for code generation.

The report assigns myfun1 a code readiness score of 3. Before generating code, you must fix the reported issues.


  • Before using coder.screener, fix issues that the Code Analyzer identifies.

  • Before generating code, use coder.screener to check that a function is suitable for code generation. Fix all the issues that it detects.

Introduced in R2012b

Was this topic helpful?