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
- Open the f14 model. 
- At the MATLAB® command prompt, enter: - report 
- In the Report Explorer, select File > New. 
- In the Properties pane, set Directory to - Present working directory.
- Save the setup file as - inport_outport.rpt.
Add Components
Add these components to the report, in order.
| From this Library Folder | Add this Component | Set this Property | 
|---|---|---|
| Simulink | Model Loop | N/A | 
| Formatting | Chapter | Title to  | 
| Simulink | Block Loop | N/A | 
| Logical and Flow Control | Logical If | Test Expression to strcmp(get_param... (RptgenSL.getReportedBlock,'BlockType'),... 'Inport') | 
| 
 | Simulink Property Table | N/A | 
The report setup file looks like this:

Run Reports
- Select - inport_outport.rpt.
- 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.
