Skip to Main Content Skip to Search
Product Documentation

Working with Looping Components

About Looping Components

A looping component runs its child components a specified number of times. There are several looping components, including logical loops and Handle Graphics loops.

The following example uses the Figure Loop, which is representative of many types of loops. The Figure Loop component runs its child components several times. In each iteration, it applies its child components to Handle Graphics figures. The figloop-tutorial report template, included with the MATLAB Report Generator software, creates a report that documents multiple Handle Graphics figures.

For background information, see Understanding Handle Graphics Objects in the MATLAB documentation.

Editing the Figure Loop Tutorial Report Template

To edit the figure loop tutorial report template, at the MATLAB command prompt, enter the following command:

setedit figloop-tutorial

Displaying Figures

To display the Handle Graphics figures, enter the following at the MATLAB command line:

figloopfigures

The figures Membrane Data, An Application, and Peaks Data appear on the screen because their visible property is 'on'. The Invisible Membrane Data and An Invisible Application figures do not appear on screen because their visible property is 'off'. These invisible figures exist, but they are hidden.

Figure Properties describes the properties of figures used in this tutorial.

Editing Figure Loop Components

Select the Figure Loop component called Figure Loop Section 1 from the Outline pane on the left. The Properties pane for the Figure Loop component appears.

Figure Properties

You can control what figures get displayed in the report, based on the properties of each figure.

Table 1.1 of the figloop-tutorial report includes a summary of the properties of the figures used in this tutorial.

For this tutorial, you will not change these properties. For background information, see Setting and Querying Property Values in the MATLAB documentation.

Looping on the Current Figure

To include only the current figure in the report, select Current figure only from the Include figures selection list. In this case, "current figure" refers to the figure that is current when the report generates. This may not be the same figure you selected as the current figure in the Report Explorer before report generation. For example, if the report generation process creates figures in your report, the last figure created with HandleVisibility set to 'on' is the current figure.

Looping on Visible Figures

To include snapshots of all visible figures in your report, select Visible figures in the Include figures selection list. This option inserts a snapshot and Property Table for all figures that are currently open and visible.

  1. Select the Data figures only (Exclude applications) option to exclude figures from the loop whose HandleVisibility parameter is 'off'.

  2. Click the Report button in the Report Explorer toolbar to generate the report.

In the generated report, scroll down to "Chapter 2 Figures in Report." The Membrane Data and Peaks Data figures appear in the generated report.

Looping on Figures with Tags

To include figures with specified tags in the report:

  1. Select the All figures with tags option in the Include figures selection list.

  2. In the list of tags, delete membrane.

  3. Click Report to generate the report.

The An Application and An Invisible Application figures appear in the report. They both have an app tag.

Modifying Section Options

In a loop, a section refers to a space in the generated report in which information, including text, images, and tables, appears. You can alter the appearance of sections in each loop appear in the report by using the options in the Figure Loop component's Section Options pane.

Create Section for Each Object in Loop.  With this option selected, the loop automatically creates an individual section for each object found in the loop. It uses the object title as the section title. This option is useful when a loop does not contain a Chapter/Subsection component that organizes the loop results.

Display the Object Type in the Section Title.  Enable this option by selecting Create section for each object in loop. The generated report precedes section titles with object titles.

  1. Enter membrane back in the list of tags.

  2. Generate the figloop-tutorial report.

    The figures produced by the loop are:

    Membrane Data
    Invisible Membrane Data
    An Application
    An Invisible Application
    
  3. Enable the Display the Object Type in the Section Title option.

  4. Generate the figloop-tutorial report.

    The figures produced are now:

    Figure - Membrane Data
    Figure - Invisible Membrane Data
    Figure - An Application
    Figure - An Invisible Application
    

    The figures produced are now:

    Figure - Membrane Data
    Figure - Invisible Membrane Data
    Figure - An Application
    Figure - An Invisible Application
    

Create a Link Anchor for Each Object in Loop.  Selecting this option creates a hyperlink to the object in the generated report.

  


Recommended Products

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

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