Generate MATLAB Code from Report Setup File
You can generate MATLAB® code versions of report setup files in the form of a MATLAB file (*.m
). A MATLAB file of a report setup file is useful for various purposes, including generating reports and modifying report setup files programmatically.
To update a MATLAB file, load a report setup file into the Report Explorer and click File > Generate MATLAB File. After the MATLAB file generates, it opens in the MATLAB Editor. The filename for the generated file is the file name of the report setup file , preceded by “build.”
This example generates a MATLAB file from the figloop_tutorial.rpt
report setup file, which is part of the MATLAB
Report Generator™ software. The example then uses the report
function to generate a report from the MATLAB file. For more information about this function, see the report
reference page.
Start the Report Explorer by entering
report
in the MATLAB Command Window.In the Options pane in the middle, double-click
figloop_tutorial.rpt
to open its report setup file.In the Outline pane on the left, click
Report - figloop_tutorial.rpt
to select it.In the Report Explorer menu bar, click File > Generate MATLAB File.
The MATLAB Report Generator software generates MATLAB code for the
figloop_tutorial.rpt
report setup file. It saves this code in thebuildfigloop_tutorial.m
file in the folder you specify. Part of this file appears in the following figure.To generate the
figloop_tutorial
report from this MATLAB file, run the following command in the MATLAB Command Window:The MATLAB Report Generator software runs and displays the report.report(buildfigloop_tutorial);