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
Open the Viewers and Generators Manager.
In the list ofGeneratorsorViewers, select the viewer or generator you want to modify.
Select the
button.
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 the
button.
Review and change parameters.
Connect Viewers and Generators
Connect signals to a new viewer or generator using the Viewers and Generators Manager.
Open the Viewers and Generators Manager panel.
Select either theViewersorGeneratorstab.
Click
.
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 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 namednewviewer
to the Viewers and Generators Manager:
Create a new Simulink®library by selectingSimulation>New>Library.
Save the library as
newlib
.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')
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.
Note
If the viewer is a compound viewer, such as a subsystem with multiple blocks, make the top-level subsystem an atomic one.
Set the
iotype
of the viewer. For example:set_param('newlib/newviewer','iotype','viewer')
Save the library
newlib
.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')
Add a corresponding
cm.addSigScope
line for each viewer or generator library you want to add.Save the
sl_customization.m
file on your MATLAB path. Edit this file to add new viewer or generator libraries.To see the new custom libraries, restart MATLAB and start the Viewers and Generators Manager.
See Also
Floating Scope|Scope|Scope Viewer