| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
Adding Multiple Signals to a Scope Viewer How to Save Data to MATLAB Workspace |
The Scope Viewer Help button is in the Scope Viewer's Parameters dialog.
Access the dialog by clicking
on the Scope Viewer toolbar.
In your block diagram, right-click a signal, and from the context menu, select Create & Connect Viewer.
From the list that appears, select the type of scope to be attached.
An empty Scope Viewer will be displayed. You must run the simulation after the viewer has been attached for the information to be plotted.
Tip You can also attach signal viewers with the Signal and Scope Manager. To learn how to do this, see Using the Signal and Scope Manager |
To add additional traces to an existing Scope Viewer:
In your block diagram, right-click the signal to be added.
From the signal context menu, select Connect to existing viewer.
A list of Signal Viewers that have already been created is displayed. From the list, select the scope to which the new signal will be added.
You can also add signals to Signal Viewers with the Signal and Scope Manager. To learn how to do this, see Using the Signal and Scope Manager.
To add a legend (a box identifying each signal in a graph):
Right-click in the viewer to display the context menu.
Click on Legends.
The color and line styles used in the display are described in How the Viewer Determines Trace Color Coding and Line Styles.
To zoom in on a region (simultaneously zooming in
on the x and y directions),
select
from the Scope Viewer toolbar, and
left-click within the graph. While holding down the mouse button,
define the region of interest.
To zoom, click and hold the left mouse button, and drag the mouse to define the zoom region bounding box. Release the mouse button to effect the change.
Select
and use the mouse to
zoom only in the x direction.
Define the zoom region by positioning the pointer at one end of the region, pressing and holding down the left mouse button, then moving the pointer to the other end of the region. Release the mouse button to effect the change. To zoom, click and hold the left mouse button, and drag the mouse to define the zoom region bounding box. Release the mouse button to effect the change.
Select
and use the mouse to
zoom only the y direction.
You can add multiple plots (called axes) to a Scope Viewer. Each axes can have different y-axis settings. This Scope Viewer has three axes, each displaying a separate signal with their own y axis settings.

To add axes to an existing Scope Viewer:
Open the Scope Viewer Signal Properties dialog.
Access this dialog from the Scope Viewer toolbar or by right-clicking within a viewer.
For information on the Scope Viewer toolbar, see The Scope Viewer Toolbar.
In the Number of axes field, enter the total number of axes for the graph.
Click OK to accept the change and dismiss the dialog.
In your block diagram, right-click on the signal to be added.
The signal context menu appears.
Select Connect to existing viewer.
A list of signal viewers is displayed.
From the list, select the scope to which the new signal will be added.
From the list of Axes, select the pane to which the signal will be plotted. The panes are numbered from top to bottom.
Repeat this step until signals for each of the axes have been assigned.
To save the data displayed on the viewer to the MATLAB workspace, perform the following steps:
Click on the
in the Viewer toolbar.
Click on the History tab.
Select Save to model signal logging object (logsout).
Enter the logging variable name in the Logging name field.
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 quickly save the viewer data to a file using the Time Series Tools.
First select the model Tools option Inspect Logged Signals. The Time Series Tools opens and the file tree contains your data on the lowest-level nodes under "logsout".
Export the data to a file by following the directions inImporting and Exporting Data.
You can plot the data interactively or programmatically.
Time Series Tools: plot the data interactively using the Time Series Tools as explained in Plotting Time Series.
Simplot: plot the data from the command line using the simplot command (see simplot). The resulting figure looks identical to the viewer window and can be annotated using the Plot Editing Tools.
![]() | Scope Viewer Context Menu | Performing Common Generator Tasks | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |