Viewers and Generators Manager

Using the Viewers and Generators Manager, you can manage viewers and generators from a central point.

Note

The Viewers and Generators Manager requires that you have Java® enabled when you start MATLAB®.

Viewers and generators are not blocks. Blocks are dragged from the Library Browser and managed with block dialog boxes. Viewers and generators are mechanisms that create or visualize signals, but are added and managed through the Viewers and Generators Manager.

Symbols identify a viewer attached to a signal line, and signal names identify generators.

Open the Viewers and Generators Manager

From the Simulation tab, open the Prepare gallery and select Viewers Manager. The Viewers and Generators Manager panel opens to the side of the Simulink editor.

You can also access the Viewers and Generators Manager by right-clicking a signal or block input and selecting Viewers and Generators Manager.

Change Parameters

  1. Open the Viewers and Generators Manager.

  2. In the list of Generators or Viewers, select the viewer or generator you want to modify.

  3. Select the button.

    • For a generator, the parameters dialog box opens for that generator type.

    • For a viewer, either a parameter dialog opens or the viewer itself opens. If the viewer opens, you can access parameters from the button.

  4. Review and change parameters.

Connect Viewers and Generators

Connect signals to a new viewer or generator using the Viewers and Generators Manager.

  1. Open the Viewers and Generators Manager panel.

  2. Select either the Viewers or Generators tab.

  3. Click .

  4. From the list of viewers or generators, select the viewer or generator you just added.

  5. Select the button. The canvas grays, indicating you are now in connect mode.

  6. For generators, click the block you want to connect the generator to and in the pop-up, select the check box for the input port you want to attach to.

    For viewers, click the signal or signals you want to visualize and in the pop-up, select the check box next to the signals you want to connect. If you have multiple displays or specific inputs, select the display you want to connect to from the drop down before selecting the check box.

  7. Close connect mode by clicking the X in the upper right corner of the canvas.

View Test Point Data

Use a Scope viewer available from the Viewers and Generators Manager to view any signal that is defined as a test point in a referenced model. A test point is a signal that you can always see when using a Scope viewer in a model.

Note

With some viewers (for example, XY Graph, To Video Display, Matrix Viewer), you cannot use the Signal Selector to select signals with test points in referenced models.

For more information, see Test Points.

Customize Viewers and Generators Manager

You can add custom signal viewers or generators so that they appear in the Viewers and Generators Manager. This procedure adds a custom viewer named newviewer to the Viewers and Generators Manager:

  1. Create a new Simulink® library by selecting Simulation > New > Library.

  2. Save the library as newlib.

  3. In the MATLAB Command Window, set the library type to a viewer library:

    set_param('newlib','LibraryType','SSMgrViewerLibrary')

    To set the library type for generators, use the type 'SSMgrGenLibrary'. For example:

    set_param('newlib','LibraryType','SSMgrGenLibrary')
  4. Set the display name of the library:

    set_param('newlib','SSMgrDisplayString','My Custom Library')
  5. Add your custom viewer or generator to the library by dragging and dropping into the Simulink canvas.

    Note

    If the viewer is a compound viewer, such as a subsystem with multiple blocks, make the top-level subsystem an atomic one.

  6. Set the iotype of the viewer. For example:

    set_param('newlib/newviewer','iotype','viewer')
  7. Save the library newlib.

  8. Using the MATLAB editor, create a file named sl_customization.m. In this file, enter a directive to incorporate the new library as a viewer library.

    For example, to save newlib as a viewer library, add these lines:

    function sl_customization(cm)
    cm.addSigScopeMgrViewerLibrary('newlib')
    %end function

    To add a library as a generator library, use this syntax instead:

    cm.addSigScopeMgrGeneratorLibrary('newlib')

  9. Add a corresponding cm.addSigScope line for each viewer or generator library you want to add.

  10. Save the sl_customization.m file on your MATLAB path. Edit this file to add new viewer or generator libraries.

  11. To see the new custom libraries, restart MATLAB and start the Viewers and Generators Manager.

See Also

| |

Related Topics