Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Performing Common Viewer Tasks

Viewing Scope Viewer Help

The Scope Viewer Help button is in the Scope Viewer's Parameters dialog.

Access the dialog by clicking on the Scope Viewer toolbar.

Attaching a Scope Viewer

  1. In your block diagram, right-click a signal, and from the context menu, select Create & Connect Viewer.

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

Adding Multiple Signals to a Scope Viewer

To add additional traces to an existing Scope Viewer:

  1. In your block diagram, right-click the signal to be added.

  2. From the signal context menu, select Connect to existing viewer.

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

Adding a Legend

To add a legend (a box identifying each signal in a graph):

  1. Right-click in the viewer to display the context menu.

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

Zooming In On Graph Regions

Displaying Multiple Axes

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:

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

  2. In the Number of axes field, enter the total number of axes for the graph.

  3. Click OK to accept the change and dismiss the dialog.

  4. In your block diagram, right-click on the signal to be added.

    The signal context menu appears.

  5. Select Connect to existing viewer.

    A list of signal viewers is displayed.

  6. From the list, select the scope to which the new signal will be added.

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

How to Save Data to MATLAB Workspace

To save the data displayed on the viewer to the MATLAB workspace, perform the following steps:

  1. Click on the in the Viewer toolbar.

  2. Click on the History tab.

  3. Select Save to model signal logging object (logsout).

  4. Enter the logging variable name in the Logging name field.

  5. Assign a name to the signal in the block diagram, for example, x1.

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

Saving the Viewer Data to a File

You can quickly save the viewer data to a file using the Time Series Tools.

  1. 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".

  2. Export the data to a file by following the directions inImporting and Exporting Data.

Plotting the Viewer Data

You can plot the data interactively or programmatically.

  


Related Products & Applications

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