Main Content

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.

林符号确定一个查看器附加到一个信号e, and signal names identify generators.

Open the Viewers and Generators Manager

From theSimulationtab, open thePreparegallery and selectViewers 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 selectingViewers and Generators Manager.

Change Parameters

  1. Open the Viewers and Generators Manager.

  2. In the list ofGeneratorsorViewers, select the viewer or generator you want to modify.

  3. Select thebutton.

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

    • 查看器,一个参数对话框打开或the viewer itself opens. If the viewer opens, you can access parameters from thebutton.

  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 theViewersorGeneratorstab.

  3. Click.

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

  5. Select thebutton. 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 theXin 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, seeConfigure Signals as 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 namednewviewerto the Viewers and Generators Manager:

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

  2. Save the library asnewlib.

  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 theiotypeof the viewer. For example:

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

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

    For example, to savenewlibas 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 correspondingcm.addSigScopeline for each viewer or generator library you want to add.

  10. Save thesl_customization.mfile 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