|On this page…|
Signal viewers are not the same as Scope blocks. For an explanation of the differences, see Scope Block and Scope Signal Viewer Differences.
Signal viewers do not show signal labels on the axis, display the simulation minor time step values, or work with Simulink® Report Generator™.
Not all signal viewer features are supported when you simulate your model in Rapid Accelerator mode. See Behavior of Scopes and Viewers with Rapid Accelerator Mode.
The Help button for a signal viewer is located on the parameters dialog box for a specific viewer type. For more information, see Scope Signal Viewer Parameters Dialog Box .
If you want to,
Quickly connect or disconnect a scope signal viewer, use the context menu.
Review all of the signal viewers and the signals connected to them, use the Signal and Scope Manager.
To attach a signal viewer with the signal content menu,
On your Simulink block diagram, right-click a signal, and then from the context menu, select Create & Connect Viewer.
From the list that appears, select the type of signal viewer you want to attach.
If you attach a scope signal viewer, a viewer window opens. You must run the simulation after you attach the viewer for the information to be plotted.
To attach a scope signal viewer using the Scope & Signal Manager,
On your Simulink block diagram, right-click a signal, and then from the context menu, select Signal & Scope Manager. The Signal & Scope Manager dialog box opens.
In the Types pane and under the Viewers node, expand a product node to show the viewers installed and available to you.
Note: The Simulink Scope displayed in the Signal and Scope Manager Types pane is not the same as the Simulink Scope Block. For an explanation of the differences, see Scope Block and Scope Signal Viewer Differences.
Under an expanded product node, select a viewer, and then click the Attach to model button.
The viewer is added to a table in the Viewers tab in the Generators/Viewers in model pane. The table lists the viewers in your model.
Each row corresponds to a viewer. The columns specify each viewer name, type, and number of inputs. If a viewer accepts a variable number of inputs, the # in entry for the viewer contains a pull-down list that displays the range of inputs that the viewer can accept. To change the number of inputs accepted by the viewer, select a value from the pull-down list.
To add additional traces to an existing signal viewer,
In the Simulink Editor, right-click a signal.
From the signal context menu, point to Create & Connect Viewer, and then from the submenu, point to a product.
From the list, select the signal viewer you want to attach to the signal.
A viewer ion is added to the signal line.
You can also add signals to a signal viewer with the Signal and Scope Manager. See Signal and Scope Manager.
Right-click a signal viewer icon. From the context menu, point to Open Viewer, and then select a viewer from the list.
Depending on the type of signal viewer, the following happens:
Scope and Floating Scope — A Viewer: Scope window opens with a graph of the signals attached to the viewer.
XY Graph — A Sink Block Parameters dialog box opens. After running a simulation, a Viewer: XY Graph window opens with a graph of the X and Y signals attached to the viewer.
Customize the signal viewer to better visualize the simulation results.
To save the data displayed on the viewer to the MATLAB® workspace, perform the following steps:
In the Viewer toolbar, click the parameters icon .
Click the History tab.
Select Save to model signal logging object (logsout).
In the Logging name field, enter a logging variable name.
Assign a name to the signal in the block diagram, for example, x1.
Run the simulation by selecting Simulation > Start.
You can now view the data in the MATLAB Command Window by entering the following commands:
logsout.unpack('all') data = x1.Data x1.time
where x1 is the name of the signal.
You can plot the data interactively or programmatically using the Simulation Data Inspector. Plot the data interactively as explained in Inspect Signal Data. The Simulation Data Inspector API allows you to plot and compare signal data programmatically as seen in Record and Inspect Signal Data Programmatically.