Simulink Report Generator
This example shows you how to use Simulink Report Generator™ to customize a System Design Description report for a model. The default version of the report provides information about a system design represented by a Simulink model. You can adapt the report to meet your needs.
This example shows you how to customize a report called System Design Description. The Simulink Report Generator product creates a default version of this report automatically from a Simulink model that you choose. However, you can generate a customized version of this report -- for example, to adhere to your organization's documentation standards.
This example assumes that you completed the previous customization described in "Customizing a System Design Description Report: Part I". In the previous example, you customized the System Design Description by editing a component that exists in the report template. This example shows you how to customize the report by adding new components to the report template. In particular, you will add a table that lists all blocks in a model.
You can customize the System Design Description for the Simulink example model, sldemo_autotrans, which represents an automotive drivetrain. To open the example model, run the following command:
From the Simulink model Tools menu, select Report Generator.
The Report Explorer graphical user interface opens.
In Report Explorer, open the custom template that you created in the previous example, "Customizing a System Design Description Report: Part I".
For your convenience, a version of the custom template is provided. To open the template in Report Explorer, run the following command:
setedit(fullfile(matlabroot, 'toolbox', 'rptgenext', 'rptgenextdemos', 'html', 'sdd_images', 'sdd_customize_part_ii', 'sdd_custom_abstract.rpt'))
Report templates contain a collection of components that specify the structure and content of a report. Report Explorer displays the hierarchy of components that comprise a template in its left-hand pane. In the center pane, Report Explorer lists components that you can add to a template. The right-hand pane displays properties for a particular component that you select in the hierarchy pane.
Take a moment to explore the different components that comprise the report template. In the previous example, you customized the Title Page component, which produces the title page at the beginning of a report. Next in the hierarchy, you'll find several Chapter components that group their contents into distinct sections. The first Chapter component contains Paragraph components that create paragraphs in the chapter; each Paragraph component contains a Text component that formats and inserts text into the paragraph. The following image depicts how each of these components contributes to the report content and structure.
The Simulink Report Generator software provides numerous components that enable you to insert and format text, tables, lists, and images in a report that you structure via a hierarchy of chapters, sections, and paragraphs. This example shows you how to customize the System Design Description by adding a table that lists the block names and types in a Simulink model. To achieve this, you insert new components into the report template.
Start by adding a new chapter to the template. In Report Explorer, in the hierarchy pane, select the Title Page component. From the list of components in the center pane, select the Chapter/Subsection component. In the right-hand pane, click the Add component to current report button.
Report Explorer inserts a new Chapter component after the Title Page. In the hierarchy, select the new Chapter component; in the Report Explorer properties pane, specify the component Title property as Block Summary.
Add a paragraph to the new chapter in your template. In Report Explorer, in the hierarchy pane, select the Chapter component. From the list of components in the center pane, select the Paragraph component. In the right-hand pane, click the Add component to current report button.
Report Explorer inserts a new Paragraph component as a child of the Chapter component. In the hierarchy, select the Paragraph component; in the Report Explorer properties pane, for the component Paragraph Text property, specify the following text:
The following table summarizes the block names and types in the Simulink model:
The Simulink Report Generator software provides a Block Type Count component that counts the number of each type of block in a model. Add this component to the new chapter in your template. In Report Explorer, in the hierarchy pane, select the Chapter component. From the list of components in the center pane, select the Block Type Count component. In the right-hand pane, click the Add component to current report button.
Report Explorer inserts a new Block Type Count component as a child of the Chapter component; however, the Block Type Count component precedes the Paragraph component in the hierarchy. Adjust the order of these components using the arrow buttons in the Report Explorer toolbar. Move the Block Type Count component in the hierarchy so that it follows the Paragraph component.
In the hierarchy, select the Block Type Count component; in the Report Explorer properties pane, select the Show total count property.
In the Report Explorer toolbar, click the Report button. When the report is complete, an application associated with the specified report format displays the customized System Design Description. The report contains a new chapter whose contents include the paragraph and table that you specified in your template.
From the Report Explorer File menu, select Save As. Specify a location and a file name for your custom report template. By saving a custom template, you can access and reuse it. For instance, you can apply the custom template to other Simulink models to create reports that have the same structure and format.
To learn more about the properties of the components that you use in this portion of the example, refer to the Chapter/SubsectionChapter/Subsection and ParagraphParagraph reference pages in the MATLAB Report Generator documentation. Also, see the Block Type CountBlock Type Count reference page in the Simulink Report Generator documentation.