Main Content

textReport

Export code generation readiness report to base workspace as a character vector

Since R2022a

Description

example

myreport = textReport(info) returns a character vector myreport that contains the code generation readiness report described by the coder.ScreenerInfo object info.

The object info and the character vector myreport contain two different representations of the code generation readiness report. If you want to display the entire report at the command line for manual inspection, use the character vector representation. If you want to programmatically retrieve information from specific parts of the report (for example, to create your own customized report), use the object representation. See coder.ScreenerInfo Properties.

Examples

collapse all

This example shows how to export the code generation readiness report that a coder.ScreenerInfo object contains to the base workspace as a character vector.

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

function [tf1,tf2] = foo2(source,target)
G = digraph(source,target);
tf1 = hascycles(G);
tf2 = isdag(G);
end

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

function [tf1,tf2] = foo1(source,target)
assert(numel(source)==numel(target))
[tf1,tf2] = foo2(source,target);
end

Analyze code generation readiness of foo1 by using coder.screener and export the report to the object info.

info =  coder.screener('foo1')
info = 

  ScreenerInfo with properties:

               Files: [2×1 coder.CodeFile]
            Messages: [2×1 coder.Message]
    UnsupportedCalls: [2×1 coder.CallSite]

    View Screener Report

The function foo2 contains calls to two MATLAB® functions hascycles and isdag that are not supported for code generation.

Export the code generation readiness report to the character vector myreport.

myreport = textReport(info)
myreport =

    'Code Generation Readiness (Text Report)
     =======================================
     
     2 Code generation readiness issues
     2 Unsupported functions
     2 Files analyzed
     
     Configuration
     =============
     
     Language: C/C++ (MATLAB Coder)
     
     Code Generation Issues
     ======================
     
     Unsupported function: digraph (2)
         - foo2.m (Line 3)
         - foo2.m (Line 4)
     
     '

Input Arguments

collapse all

coder.ScreenerInfo object containing a representation of the code generation readiness report. coder.ScreenerInfo Properties.

Output Arguments

collapse all

Character vector containing a code generation readiness report.

Version History

Introduced in R2022a