Main Content

MATLABCode Analysis

Identify and fix issues in MATLAB®code that prevent C/C++ code generation

Successful C/C++ code generation from MATLAB code depends on compliance with code generation rules and limitations. For example, your MATLAB code must only use MATLAB functions and toolbox functions supported for code generation. To identify and fix issues with your MATLAB code, prior to C/C++ code generation, you can use the Code Analyzer and Code Readiness Tool. To check that your MATLAB code produces generated code that works as expected, generate and execute a MEX function, which is executable and testable in the MATLAB environment.

Functions

codegen Generate C/C++ code fromMATLABcode
coder.runTest Run test replacing calls toMATLABfunctions with calls to MEX functions
coder.screener Determine if function is suitable for code generation
getLineColumn Find locations of beginning and end ofMATLABcode involved in code generation
textReport Export code generation readiness report to base workspace as a character vector

Properties

coder.CallSite Properties Information about a function call site in yourMATLABcode
coder.CodeFile Properties Description of file containing text that is involved in code generation
coder.File Properties Description of file without text that is involved in code generation
coder.Message Properties Description of message produced during code generation readiness analysis or during code generation
coder.ScreenerInfo Properties Code generation readiness information

Topics

MATLABCode Analysis Basics

Code Analyzer

Code Readiness Tool

MEX Function Testing

Troubleshooting