Using the Viewers and Generators Manager, you can manage viewers and generators from a central point.
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.
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.
Open the Viewers and Generators Manager.
In the list of Generators or Viewers, select the viewer or generator you want to modify.
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.
Review and change parameters.
Connect signals to a new viewer or generator using the Viewers and Generators Manager.
Open the Viewers and Generators Manager panel.
Select either the Viewers or Generators tab.
From the list of viewers or generators, select the viewer or generator you just added.
Select the button. The canvas grays, indicating you are now in connect mode.
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.
Close connect mode by clicking the X in the upper right corner of the canvas.
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.
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 Configure Signals as Test Points.
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:
Create a new Simulink® library by selecting Simulation > New > Library.
Save the library as
In the MATLAB® Command Window, set the library type to a viewer library:
To set the library type for generators, use the type
'SSMgrGenLibrary'. For example:
Set the display name of the library:
set_param('newlib','SSMgrDisplayString','My Custom Library')
Add your custom viewer or generator to the library by dragging and dropping into the Simulink canvas.
If the viewer is a compound viewer, such as a subsystem with multiple blocks, make the top-level subsystem an atomic one.
iotype of the viewer. For example:
Save the library
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
function sl_customization(cm) cm.addSigScopeMgrViewerLibrary('newlib') %end function
To add a library as a generator library, use this syntax instead:
Add a corresponding
cm.addSigScope line for each viewer
or generator library you want to add.
sl_customization.m file on your MATLAB path. Edit this file to add new viewer or generator
To see the new custom libraries, restart MATLAB and start the Viewers and Generators Manager.