Documentation Center

  • Trial Software
  • Product Updates

Signal Viewer Tasks

About Signal Viewers

Signal viewer

Attaching a Signal Viewer

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.

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 the Simulink Editor, right-click a signal.

  2. From the signal context menu, point to Create & Connect Viewer, and then from the submenu, point to a product.

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

    Note:   You must run a simulation for the new signal trace to display in a viewer.

    Note:   If you add or remove signals from a Signal Viewer, the Signal Viewer title and legends update only when you run a simulation, and then open the viewer.

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.

Saving 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 parameters 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:

data = x1.Data

where x1 is the name of the signal.

Plotting the Viewer Data

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.

Was this topic helpful?