| Contents | Index |
This component loops on Simulink models and systems, as specified by child components. For example, you can use a Model Loop with a child System Loop to report on the subsystems of the specified system.
Consider making these components children of the Model Loop (although the Model Loop not necessarily required to be the immediate parent of a given component).
You can add a model to the list by clicking Add New Model to List. The following table shows the buttons you can use to move a model up or down in the list, or to add or delete a model.
Button | Action |
|---|---|
|
| Move a model up in the list. |
|
| Move a model down in the list. |
|
| Remove a model from the list. |
|
| Add a new model to the list. |
Active: Includes a given model in the loop. This option is selected by default. Clearing this option omits the model from the loop.
This option allows you to temporarily omit one or more models from a report.
Model name: Specifies the model name.
Current block diagram
All open models
All open libraries
Block diagrams in current directory
Custom block diagram: Selecting this option automatically sets the Starting system(s) field $top to start in the model root system.
%<VariableName>: For more information, see %<VariableName> Notation on the Text component reference page in the MATLAB Report Generator documentation.
Traverse model: Specifies the systems to traverse.
All systems in model
Selected system(s) only
Selected system(s) and ancestors
Selected system(s) and children
Look under masks: Specifies how to handle masks.
Functional masks only
No masks
All masks
Graphical masks only
For more information, see Working with Block Masks in the Simulink documentation.
Follow library links: Specifies library links to include.
Do not follow library links
Include library links
Include unique library links
For more information, see Creating a Linked Block in the Simulink documentation.
Model reference: Specifies whether to report on models referenced by a Model block. If you want to report on referenced models, then you can control the depth of the model referencing hierarchy and whether to report on model reference variants.
Do not follow model reference blocks: Do not report on blocks contained in referenced models.
Follow all model reference blocks: Report on blocks contained in all models that any part of the model hierarchy references.
Follow model reference blocks defined in current model: Report on blocks in models that the currently selected model references.
<Custom model reference depth>: Report on blocks in models that your specified level in the model reference hierarchy references.
Include all variants: Report on all model reference variants. To enable this option, set the Model reference option to report on blocks in referenced models.
Starting system(s): Specifies the system in which to start the loop. Available options depend on the value that you select in the Traverse model option. Selecting any option other than All systems in model for Traverse model activates the Starting system(s) option.
If you do not enter a model name in the Model name option, then select either Root model or Current to specify where to start the loop.
If you specify a model name in the Model name option, then the Starting system(s) option provides an edit box in which you can enter:
The full path of a subsystem or subsytems
$top to start the loop in the model root system
$current to start the loop in the currently selected system
Create section for each object in loop: Inserts a section in the generated report for each object found in the loop.
Display the object type in the section title: Inserts the object type automatically into the section title in the generated report.
Create link anchor for each object in loop: Creates a hyperlink to the object in the generated report.
Generating Reports on Specified Systems and their Subsystems
This example shows how to loop over a specified system and its subsystems in the sample model sldemo_auto_climate_elec, which the Simulink software includes.
(Optional) To open the sldemo_auto_climate_elec model, at the MATLAB command prompt, enter the following command:
sldemo_auto_climate_elec
Explore the model to familiarize yourself with its subsystems.
Open the Report Explorer.
Create a report setup file by clicking File > New.
Save the report setup file by clicking File > Save As. Give it the name sldemo_auto_report.
Add a Chapter/Subsection component to the report setup file to include information about model subsystems:
In the Library pane in the middle, double-click Chapter/Subsection to add it to the report setup file.
For Title, choose Custom. In the title field, enter Description of sldemo_auto_climate_elec subsystems.
Add a Model Loop as a child of the Chapter/Subsection component. This loops over the ClimateControlSystem system and its subsystems in the sldemo_auto_climate_elec model:
In the Library pane in the middle, double-click Model Loop to add it to the report setup file. By default, the Report Explorer adds that component as a child of the Chapter/Subsection component.
In the Model Loop properties pane, from the Model name selection list, select <Custom block diagram> .
In the Model name field, delete the text <Custom block diagram>, and then enter sldemo_auto_climate_elec.mdl. Click any component in the report setup file to add this model to the Models to include list.
In the Traverse model selection list, select Selected system(s) and children.
In the Look under masks selection list, select All masks.
In the Model reference selection list, select Do not follow model reference blocks.
In the Starting system(s) field, enter sldemo_auto_climate_elec/ClimateControlSystem. Because you selected Selected system(s) and children for Traverse model, the Model Loop loops over sldemo_auto_climate_elec/ClimateControlSystem and its subsystems.
Under Section Options, select the Create section for each object in loop check box. Selecting this option creates separate sections in the generated report for each model over which the component loops.
The Model Loop properties pane looks as follows.

Save the report by clicking File > Save.
Add a System Loop as a child of the Model Loop component.
In the Library pane in the middle, double-click System Loop to add it to the report setup file. By default, Model Explorer adds this component as a child of the Model Loop component.
In the System Loop properties pane, under Section Options, select the Create section for each object in loop check box. Selecting this option creates a section in the generated report for each subsystem on which the component loops. Accept the default values for all other fields.
Add a System Snapshot component as a child of the System Loop component. This step creates snapshots of all the subsystems of ClimateControlSystem in the generated report. In the Library pane in the middle, double-click System Snapshot. By default, Model Explorer adds this component as a child of the System Loop component.
Save the report.
The report setup file hierarchy now looks as follows.

Run the report by clicking File > Report.
The report loops on the system ClimateControlSystem of the sldemo_auto_climate_elec model and all of its subsystems, as shown in the following Message List.

The report looks as follows.

Temporarily Omitting a Model from a Loop
This example shows how to use the Model Loop Active check box to temporarily omit a model from the loop. This example uses the report setup file that you created in Generating Reports on Specified Systems and their Subsystems, sldemo_auto_report.rpt, and the model f14.mdl, which the Simulink software includes.
In the Report Explorer, click File > Open, and then open sldemo_auto_report.rpt by double-clicking it.
In the Outline pane on the left, click Model Loop Section 1 - sldemo_auto_climate_elec.
In the Model Loop properties pane,
click the
button to add a model to the Models
to include list.
In the Model Loop properties pane, from the Model name selection list, select <Custom block diagram>.
In the Model name field, delete the text <Custom block diagram> and enter f14.mdl.
The Model Loop properties pane now looks as follows.

Save the report setup file.
Generate the report.
The report generation process loops over the specified systems in the f14 and sldemo_auto_climate_elec models, as shown in the following message box.

The report looks as follows.

In the Models to include list, click f14 to select it.
Clear the Active check box to omit f14 model information from the generated report.
Rerun the report.
The report now includes information only on the sldemo_auto_climate_elec model, as shown at the end of the previous example, Generating Reports on Specified Systems and their Subsystems.
To reactivate the f14 model, in the Model Loop Models to include list, select the f14 model and then select the Active check box.
Yes, inserts a section if you select the Create section for each object in loop option.
rptgen_sl.csl_mdl_loop

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |