Main Content

Filter with Loop Context Functions

Use loop context functions to filter the modeling elements to report on and to perform special reporting on specific elements.

In the following example, in a Block Loop component, you use RptgenSL.getReportedBlock in a Logical If component to report on targeted blocks within a Block Loop component.

For a summary of loop context functions, see Loop Through Context Functions.

Create and Save Setup Files

  1. Open the f14 model.

  2. At the MATLAB® command prompt, enter:

    report
  3. In the Report Explorer, select File > New.

  4. In the Properties pane, set Directory to Present working directory.

  5. Save the setup file as inport_outport.rpt.

Add Components

Add these components to the report, in order.

From this Library FolderAdd this ComponentSet this Property

Simulink

Model Loop

N/A

Formatting

Chapter

Title to Inport Blocks

Simulink

Block Loop

N/A

Logical and Flow Control

Logical If

Test Expression to

strcmp(get_param...
(RptgenSL.getReportedBlock,'BlockType'),...
'Inport')

Simulink

Simulink Property Table

N/A

The report setup file looks like this:

Run Reports

  1. Select inport_outport.rpt.

  2. From the context menu, select Report.

The report includes a chapter with properties for the Inport blocks only.

If you wish, create a second chapter that reports on Outport blocks only, as shown below.