This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Floating Scope and Scope Viewer Tasks

Add Floating Scope Block to Model

To add a Floating Scope block from the Simulink® block library:

  1. From the Simulink Editor menu, click the Library Browser button .

  2. From the Simulink Sinks library, drag a copy of the Floating Scope block to the Simulink Editor.

To add a Floating Scope block by searching from the model diagram:

  1. In the Simulink Editor, click the model diagram, and then start typing floating scope.

  2. From the list, select Floating Scope Simulink/Sinks.

Add Scope Viewer with Signal & Scope Manager

  1. From the Simulink Editor menu, select Diagram > Signals & Ports > Signal & Scope Manager.

  2. In the Signal & Scope Manager, in the Types pane and under the Viewers node, expand a product node to show the available viewers.

  3. Select a Scope, and then click Attach to model. The viewer is added to a table on the Viewers tab in the Generators/Viewers in model pane.

Connect Signals to Floating Scope Block or Scope Viewer

Connect signals to a Floating Scope block or Scope viewer.

  1. Open the scope by double-clicking a Floating Scope block or Scope viewer icon .

  2. In the scope window toolbar, click the signal selection button . You may need to select the lock dropdown to see the button.

    The Simulink canvas grays, indicating you can interactively select signals to connect to the scope.

  3. Select the signals you want to connect to the scope. For multiple signals, click and drag multiple signals.

  4. In the Connect pop-up, select the check box next to the signals you want to connect.

  5. For scopes with multiple displays, select a display from the drop-down and connect the signals.

  6. Click the X in the upper-right of the Simulink canvas and then run a simulation.

Save Simulation Data Using Floating Scope Block

This procedure uses the model vdp to demonstrate saving signals to the MATLAB® Workspace.

  1. Add a Floating Scope or Scope Viewer to your model. See Add Floating Scope Block to Modelor Add Scope Viewer with Signal & Scope Manager.

  2. Connect signals to the scope, see Connect Signals to Floating Scope Block or Scope Viewer. For example, select the signals x1 and x2.

  3. Open a Floating Scope or Scope Viewer window. From the toolbar, click the Parameters button .

  4. Click the Logging tab, and then select the Log/Unlog Viewed Signals to Workspace button.

    This selection also sets the Log signal data parameter check box for the connected signals. The Simulink Editor places logging symbols on the signals.

  5. Open the Configuration Parameters dialog box by selecting Simulation > Model Configuration Parameters. In the Configuration Parameters, select Data Import/Export.

  6. Select the Signal logging check box. Use the default Dataset object name logsout or enter your own name. Click OK.

  7. Run a simulation. Simulink saves data to the MATLAB Workspace in a Dataset object with two elements, one element for each signal.

  8. In the MATLAB Command Window, enter these commands to view the logged data from logsout, where x1 is the name of a signal:

    x1_data = logsout.get('x1').Values.Data
    x1_time = logsout.get('x1').Values.Time
    plot(x1_time,x1_data)
    

Run Simulation from Floating Scope Window

  1. From a Simulink model, double-click a Floating Scope block.

  2. From the toolbar, click the Run button .

For information on using toolbar buttons to control a simulation, see Step Through a Simulation.

Delete Scope Viewer

  1. Right-click any signal line with a viewer attached or click the viewer symbol attached to a signal line.

  2. Select Delete Viewer, and then select a viewer name.

Quickly Switch Visualization of Different Signals on a Floating Scope

  1. Open a Floating Scope window.

  2. On the toolbar, click the Lock button so that the icon is unlocked .

  3. On the model, click a signal line to select and highlight the signal line. To select multiple signals, hold down the Shift key while selecting signals.

    After clicking on the canvas, the selected display clears any previous signal connections.

  4. Run a simulation. As long as the unlock icon is showing, you can click between signals to switch which signal appears in the Floating Scope.

See Also

| |

Related Topics