Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Report Generator   

Generating MATLAB Code from Report Templates

You can generate M-code versions of report templates in the form of a MATLAB file (*.m). An M-file of a report template is useful for various purposes, including generating reports and modifying report templates programmatically.

To generate an M-file, load a report template into the Report Explorer and click File > Generate M-File. After the MATLAB file generates, it opens in the MATLAB Editor. The filename for the generated file is the report template filename, preceded by "build".

Generating Reports from MATLAB files

This example generates a MATLAB file from the figloop_tutorial.rpt report template, 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.

  1. Start the Report Explorer by entering report in the MATLAB Command Window.

  2. In the Options pane in the middle, double-click figloop_tutorial.rpt to open its report template.

  3. In the Outline pane on the left, click Report - figloop_tutorial.rpt to select it.

  4. In the Report Explorer menu bar, click File > Generate M-File.

    The MATLAB Report Generator software generates MATLAB code for the figloop_tutorial.rpt report template. It saves this code in the buildfigloop_tutorial.m file in the folder you specify. Part of this file appears in the following figure.

  5. To generate the figloop_tutorial report from this MATLAB file, run the following command in the MATLAB Command Window:

     report(buildfigloop_tutorial);

    The MATLAB Report Generator software runs and displays the report.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS