| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
Embedded MATLAB Coder produces reports in HTML format at compile time to help you debug your MATLAB code and verify compliance with the Embedded MATLAB subset.
Embedded MATLAB Coder automatically produces a compilation report if it detects errors or warnings.
You can also use the option to request reports even when there are no errors or warnings.
The report provides links to your MATLAB code and C/C++ code files. It also provides compile-time type information for the variables and expressions in your MATLAB code. This information simplifies finding sources of error messages and aids understanding of type propagation rules.
For example, to generate an embeddable C/C++ library for the file demo.m with a compilation report using emlc, at the MATLAB command line, enter:
emlc -T rtw:lib -report demo
Embedded MATLAB Coder produces compilation reports in the following locations. The top-level html file at each location is index.html.
For MEX targets (mex):
output_folder/mexfcn/primary_function_name/html
For C/C++ executable targets (rtw:exe):
output_folder/rtwexe/primary_function_name/html
For C/C++ library targets (rtw:lib):
output_folder/rtwlib/primary_function_name/html
Note The default output folder is emcprj, but you can specify a different folder with the -d option (see emlc in the Real-Time Workshop reference documentation). |
If you specify the -launchreport option, the compilation report opens automatically.
To open the compilation report if no compilation errors occurred, click the Open compilation report link in the MATLAB Command Window.

To open the error report if compilation errors occurred, click the Open error report link in the MATLAB Command Window.

When you compile MATLAB files with the -report option, Embedded MATLAB Coder generates an HTML report. The following example shows a report for a successful compilation.

The report provides the following information, as applicable:
MATLAB code information, including a list of all functions and their compilation status
Call stack information, providing information on the nesting of function calls
Links to generated C/C++ code files
Summary of compilation results, including type of target and number of warnings or errors
List of all error and warning messages
List of all variables in your MATLAB code
Target build log that records compilation and linking activities
To view your MATLAB code, click on the MATLAB code tab. The compilation report displays the code for the function highlighted in the list on this tab.
The MATLAB code tab provides:
A list of the MATLAB functions that have been compiled. The report displays icons next to each function name to indicate whether compilation was successful:
Errors in function.
Warnings in function.
Successful compilation,
no errors or warnings.
A filter control, Filter function list by attributes, that you can use to sort your functions by:
Size
Complexity
Class
The compilation report annotates the subfunction with the name of the parent function in the list of functions on the MATLAB code tab.
For example, if the MATLAB function fcn1 contains the subfunction subfcn and fcn2 contains the subfunction subfcn2, the report displays:
fcn1 > subfcn1 fcn2 > subfcn2
If your Embedded MATLAB function calls the same function with different types of inputs, the compilation report numbers each of these specializations in the list of functions on the MATLAB code tab.
For example, if the function fcn calls the function subfcn with different types of inputs:
function y = fcn(u) %#eml % Specializations y = y + subfcn(single(u)); y = y + subfcn(double(u));
The compilation report numbers the specializations in the list of functions.
fcn > subfcn > 1 fcn > subfcn > 2
The compilation report provides call stack information:
On the Call stack tab.
In the list of Callers.
If a function is called from more than one function, this list provides details of each call-site. Otherwise, the list is disabled.
To view call stack information, click the Call stack tab.
The call stack lists the functions in the order that the top-level function calls them. It also lists the subfunctions that each function calls.
If there is more than one entry-point function, the call stack displays a separate tree for each entry point. You can distinguish easily between shared and entry-point specific functions. If you click a shared function, the report highlights all instances of this function. If you click an entry-point specific function, the report highlights only that instance.
For example, in the following call stack, ezep1 and ezep2 are entry-point functions, and identity is an entry-point specific function, called only by ezep1. Functions ezep3 and shared are shared functions.

If a function is called from more than one function, this list provides details of each call site. To navigate between call-sites, select a call-site from the Callers list. If the function is not called more than once, this list is disabled.
For example, if you select the entry-point function ezep2 in the call stack, the Callers list displays the other call-site in ezep1.

To view a list of the generated C/C++ files, click the C-code tab. The compilation report displays a list of the generated files. Click a file in the list to view the code in the code pane.
When viewing C/C++ code in the code pane, click the blue link to the source file at the top of the pane to open the associated source code file in the MATLAB editor.
The compilation report provides links to the definitions of data types. When viewing C/C++ code in the code pane, click the blue link for a data type to see its definition.
To view a summary of the compilation results, including type of target and number of errors or warnings, click the Summary tab.
Embedded MATLAB Coder automatically reports errors and warnings. If errors occur during compilation, Embedded MATLAB Coder does not generate code. The report lists the messages in the order that the compiler detects them. It is best practice to address the first message in the list, because often subsequent errors and warnings are related to the first message. If compilation produces warnings, but no errors, Embedded MATLAB Coder does generate code.
The compilation report provides information about errors and warnings by:
Listing all errors and warnings in the All Messages tab. The report lists these messages in chronological order.
Highlighting all errors and warnings in the MATLAB code pane
If errors or warnings occurred during compilation, click the All Messages tab to view a complete list of these messages. The compilation report marks messages as follows:
|
| Error |
|
| Warning |
To locate the offending line of code for an error or warning in the list, click the message in the list. The compilation report highlights errors in the list and MATLAB code in red and warnings in orange. Click the blue line number next to the offending line of code in the MATLAB code pane to go to the error in the source file.

If errors or warnings occurred during compilation, the compilation report underlines them in your MATLAB code. The report underlines errors in red and warnings in orange. To learn more about a particular error or warning, place your pointer over the underlined text.
The compilation report provides compile-time type information for the variables and expressions in your MATLAB code, including name, type, size, complexity, and class. The report also provides type information for fixed-point data types including word length and fraction length. You can use this type information to find sources of error messages and to understand type propagation rules.
You can view information about the variables in your MATLAB code by:
Viewing the list in the Variables tab
Placing your pointer over the variable name in your MATLAB code
To view a list of all the variables in your MATLAB function, click the Variables tab. The compilation report displays a complete list of variables in the order they appear in the function selected in the MATLAB code tab. Clicking a variable in the list highlights all instances of that variable, and scrolls the MATLAB code pane so that the first instance is in view.
Tip You can sort the variables by clicking the column headings in the Variables tab. To sort the variables by multiple columns, hold down the Shift key when clicking the column headings. |
The report provides the following information about each variable, as applicable. The report only displays a column if at least one variable in the code has information in that column. For example, if the code does not contain any fixed-point data types, the report does not display the DT mode, WL or FL columns.
Name
Type
Size
Complexity
Class
DataTypeMode (DT mode) — for fixed-point data types only. For more information, see DataTypeMode in the Fixed-Point Toolbox documentation.
Signed — sign information for built-in data types, signedness information for fixed-point data types
Word length (WL) — for fixed-point data types only
Fraction length (FL) — for fixed-point data types only
Note For more information on viewing fixed-point data types, see Working with Fixed-Point Compilation Reports in the Fixed-Point Toolbox documentation. |
Viewing Information about Variable-Size Arrays in the Variables Tab. For variable-size arrays, the size field includes information on the computed maximum size of the array. The size of each array dimension that varies is prefixed with a colon :.

If Embedded MATLAB technology cannot compute the maximum size of a variable-sized array, the compilation report displays the size as :?.

For more information on how to use the size information for variable-sized arrays, see Working with Variable-Size Data in the Embedded MATLAB documentation.
Viewing Renamed Variables in the Variables Tab. If your Embedded MATLAB function reuses a variable with different size, type, or complexity, whenever possible, Embedded MATLAB creates separate uniquely named variables in the generated code. (For more information, see Reusing the Same Variable with Different Properties in the Embedded MATLAB documentation.) The compilation report numbers the renamed variables in the list in the Variables tab. When you place your pointer over a renamed variable, the compilation report highlights only the instances of this variable that share the same data type, size, and complexity.
For example, suppose your code uses the variable t in a for-loop to hold a scalar double, and reuses it outside the for-loop to hold a 5x5 matrix. The compilation report displays two variables, t>1 and t>2 in the list in the Variables tab.

To view information about a particular variable or expression in your Embedded MATLAB function code, place your pointer over the variable name or expression in the MATLAB code pane. The compilation report highlights variables and expressions in different colors:
Green, when the variable has data type information at this location in the code.

For variable-sized arrays, the size field includes information on the computed maximum size of the array. The size of each array dimension that varies is prefixed with a colon :. Here the array A is variable-sized with a maximum computed size of 1 x 100.

Pink, when the variable has no data type information.

Purple, information about expressions. You can also view information about expressions in your MATLAB code. Place your pointer over an expression in the MATLAB code pane. The compilation report highlights expressions in purple and provides more detailed information.

Red, when there is error information for an expression. If the Embedded MATLAB software cannot compute the maximum size of a variable-sized array, the compilation report underlines the variable name and provides error information.

If Embedded MATLAB Coder compiles your MATLAB code without errors, it provides target build information in the Target Build Log tab, including:
Build folder
Clicking this link changes the MATLAB current folder to the build folder.
Make wrapper
The name of the batch file that Embedded MATLAB Coder used for this build.
Build log

You can use the following keyboard shortcuts to navigate between the different panes in the compilation report. Once you have selected a pane, use the Tab key to advance through data in that pane.
| To select ... | Use... |
|---|---|
| MATLAB Code Tab | Ctrl+m |
| Call Stack Tab | Ctrl+k |
| C Code Tab | Ctrl+c |
| Code Pane | Ctrl+w |
| Summary Tab | Ctrl+s |
| All Messages Tab | Ctrl+a |
| Variables Tab | Ctrl+v |
| Target Build Log Tab | Ctrl+t |
The compilation report displays information about the variables and expressions in your Embedded MATLAB code with the following limitations:
Column Headings on Variables Tab
![]() | How emlc Generates Code | Calling Generated C/C++ Functions | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |