Documentation

Simulink Workspace Variable

Report on workspace variables used in model, in loop generated by Simulink Workspace Variable Loop component

Description

This component provides information about those workspace variables that the Simulink® model uses, in a loop generated by a Simulink Workspace Variable Loop component. Your report setup must include Simulink Workspace Variable component as a child of a Simulink Workspace Variable Loop component.

The report includes the name and value each variable. Optionally, you can include the following information for each variable:

  • Variable source (MATLAB® workspace, model workspace, or data dictionary)

  • Blocks that use the variable

For variables that are Simulink data objects (for example, a Simulink.Parameter object), the report includes the properties of the object. You can filter out properties to streamline the report.

Use a Simulink Workspace Variable Loop component as a parent for a Simulink Workspace Variable component. In the Report Options dialog box, select Compile model to report on compiled information.

Options

The following options specify additional information that the report can include about each variable:

  • Show workspace: Report the source of each variable — MATLAB workspace, model workspace, or data dictionary.

  • Show blocks that use variable: Report the blocks that use each variable.

For variables whose values are Simulink data objects, you can filter the properties to include in the report, using one of the following approaches:

  • Use the Filter Properties area of the dialog box to specify a standard filter.

    The standard filter options apply to all variables whose values are instances of the class or classes that you specify. For example, you can use a standard filter to filter out the Description property for all variables used by the model whose values use a Simulink.Parameter object.

  • Select the Use custom property filter option and write MATLAB code for filtering.

    Writing custom filtering code allows you to do kinds of filtering that the standard filter does not perform. Some common examples of custom filters that you might want to create are filters that filter out:

    • A property for some, but not all, instances of a class

    • Properties that match a regular expression

The Filter Properties area of the dialog box, where you specify a standard filter, has these fields.

  • Class name (* for all classes): Specify the class of the variables for which you want to filter out specific properties. You can specify one class at a time, or enter an asterisk (*) to specify all classes. After you enter the class name, move the cursor outside of the edit box.

  • Available Properties: If the class that you entered in Class name (* for all classes) is on the MATLAB path, then this list displays the properties of that class.

  • Filtered Properties: Displays the properties to filter out. Use the right-arrow button to add to the Filtered Properties list the properties that you selected in the Available Properties list.

  • If the class that you enter is not on the MATLAB path, then a Comma-separated list of properties to be filtered edit box appears. Enter the names of properties to use for filtering.

  • Convert to Custom: Generate custom MATLAB code that implements your Filter Properties standard filter settings.

    Note

    Selecting the Convert to Custom button overwrites any existing MATLAB custom filtering code for this component.

To create and apply custom filtering MATLAB code, select the Use custom property filter check box. Selecting this check box opens an edit box where you define a MATLAB function for filtering properties. The edit box includes a sample function (commented out) that you can use as a starting point for your filtering function. Use the isFiltered variable for the output of your function. For example:

  • To filter out the Owner and testProp properties, in the edit box enter:

    isFiltered = strcmpi(propertyName, 'Owner')||...
    strcmpi(propertyName, 'testProp');
  • To filter out all properties except for the CoderInfo property, in the edit box, enter:

    isFiltered = ~strcmpi(propertyName, 'CoderInfo');

If you clear the Use custom property filter check box, Simulink Report Generator™ saves your custom MATLAB filtering code, but does not use that code to filter properties.

Insert Anything into Report?

Yes. List.

Class

rptgen_sl.csl_ws_variable

Was this topic helpful?