Skip to Main Content Skip to Search
Product Documentation

Signal Viewer Tasks

About Signal Viewers

Attaching a Signal Viewer

If you want to,

Using the Context Menu

To attach a signal viewer with the signal content menu,

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

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

Using the Signal and Scope Manager

To attach a scope signal viewer using the Scope & Signal Manager,

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

  2. In the Types pane and under the Viewers node, expand a product node to show the viewers installed and available to you.

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

Adding Signals to a Signal Viewer

To add additional traces to an existing signal viewer,

  1. In your block diagram, right-click a signal.

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

    A list of signal viewers that were added to your model is displayed.

  3. From the list, select the signal viewer to attach the signal.

You can also add signals to signal viewers with the Signal and Scope Manager. See Signal and Scope Manager.

Displaying a Signal Viewer

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

  2. Customize the signal viewer to better visualize the simulation results.

Zooming In On Graph Regions

How to Save Data to MATLAB Workspace

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

  1. In the Viewer toolbar, click the properties icon .

  2. Click the History tab.

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

  4. In the Logging name field, enter a logging variable name.

  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.

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-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS