Main Content

Code Verification

Behavioral verification of generated code, traceability, code generation reports

After you generate code, inspect the source code and output results for verification purposes. The code generation report provides an interactive interface for inspecting the generated C/C++ source files, generated data types, and other code insights. Access a subset of information from the code generation report programmatically by using the report information object. You can test the output of generated MEX code against the original MATLAB® code, or you can create custom tests based on the MATLAB unit test classes. You can choose to generate run-time error checks that alert you to errors that occur during code execution.


codegenGenerate C/C++ code from MATLAB code
coder.configCreate MATLAB Coder code generation configuration objects
coder.runTestRun test replacing calls to MATLAB functions with calls to MEX functions
getLineColumnFind locations of beginning and end of MATLAB code involved in code generation
coder.ignoreConstPrevent use of constant value of expression for function specializations
coder.ignoreSizePrevent code generator from creating function specializations for constant-size expressions (Since R2019b)
coder.mfunctionnameName of calling function or method (Since R2021b)


coder.HardwareImplementationHardware-specific configuration parameters for C/C++ code generation from MATLAB code


coder.MexCodeConfigConfiguration parameters for MEX function generation from MATLAB code
coder.CodeConfigConfiguration parameters for C/C++ code generation from MATLAB code
coder.EmbeddedCodeConfigConfiguration parameters for C/C++ code generation from MATLAB code with Embedded Coder


coder.ReportInfo PropertiesCode generation report information
coder.Summary PropertiesSummary of code generation from MATLAB code
coder.File PropertiesDescription of file without text that is involved in code generation
coder.CodeFile PropertiesDescription of file containing text that is involved in code generation
coder.Function PropertiesDescription of MATLAB function used in code generation
coder.Method PropertiesDescription of method in a MATLAB class used in code generation
coder.Message PropertiesDescription of message produced during code generation readiness analysis or during code generation
coder.BuildLog PropertiesBuild logs produced during code generation (Since R2019b)


Code Generation Reports

Testing Generated Code

Run-Time Error Detection