Floating Scope and Scope Viewer - Display signals generated during simulation without signal lines - Simulink (original) (raw)
Display signals generated during simulation without signal lines
Libraries:
Simulink / Sinks
HDL Coder / Sinks
Description
The Simulink® Scope Viewer and Floating Scope block display time domain signals with respect to simulation time. The Scope Viewer and Floating Scope block have the same functionality as the Scope block, but they are not connected to signal lines.
Scope Tab
This screenshot highlights the important aspects of the scope window.
Scope display features:
- Simulation control — Run and debug models from a Scope window usingRun, Step Forward, andStep Backward toolbar buttons.
- Multiple signals — Plot multiple signals on the same display.
- Multiple displays — Display signals on multiple subplots. All the_y_-axes of the subplots have a common time range on the _x_-axis. Control the layout of the subplots using the Display Grid parameter in theScope tab of the toolstrip.
- Modify parameters — Modify scope parameter values before and during a simulation.
- Axis autoscaling — Autoscale axes during or at the end of a simulation. Margins are drawn at the top and bottom of the axes.
- Display data after simulation — Scope data is saved during a simulation. If a scope is closed at the start of a simulation, when you open the scope after a simulation, the scope displays simulation results for attached input signals.
Note
If you have a high sample rate or long simulation time, you may run into issues with memory or system performance because the scope saves data internally. To limit the amount of data saved for scope visualization, use theLimit data points to last
property. - Scope window management –– Use the new scope container to dock multiple scope windows into a single window and to manage and organize the scopes. The scope container also enables you to view all the scopes in the model in a single window.
Measurements Tab
This screenshot highlights the important aspects of the measurements window.
Here is a list of all the measurements the Scope Viewer andFloating Scope block supports:
- Triggers — Set triggers on repeating signals and pause the display when events occur.
- Cursor Measurements — Measure signal values using vertical and horizontal cursors.
- Signal Statistics — Display the maximum, minimum, peak-to-peak difference, mean, median, and RMS values of a selected signal.
Note
You must have a Simscape™ or DSP System Toolbox™ license to use the Peak Finder, Bilevel Measurements, and Signal Statistics. - Peak Finder — Find maxima, showing the _x_-axis values at which they occur.
- Bilevel Measurements — Measure transitions, overshoots, undershoots, and cycles.
You must have a Simscape or DSP System Toolbox license to use the Peak Finder, Bilevel Measurements, and Signal Statistics.
For information on controlling a Floating Scope block from the command line, see Control Scope Blocks Programmatically.
Connect Signals
In the Floating Scope window or Scope viewer window, use the button to connect signals.
To add a viewer with a connected signal, select a signal in the model. Then, on the Simulation tab, in the Prepare gallery, click Add Viewer.
For more details, see Add Signals to Existing Floating Scope or Scope Viewer.
Key Features
- Multiple _y_-axes (displays) — Display multiple_y_-axes. All the _y_-axes have a common time range on the _x_-axis.
- Multiple signals — Show multiple signals on the same_y_-axis (display).
- Modify parameters — Modify scope parameter values before and during a simulation.
- Display data after simulation — If a scope is closed at the start of a simulation, scope data is still written to the scope during the simulation. If you open the scope after a simulation, the scope displays simulation results for input signals.
Examples
Limitations
When you use model configuration parameters that optimize the simulation, such as or Block reduction, Simulink eliminates storage for some signals during simulation. You are unable to apply a Floating Scope to these eliminated signals. To work around this issue, configure an eliminated signal as a test point. You can then apply aFloating Scope to the signal regardless of optimization settings. To configure test points, see Configure Signals as Test Points.
- If you step back the simulation after adding or removing a signal, the Floating Scope clears the existing data. New data does not appear until the simulation steps forward again.
- When connected to a constant signal, the scope plots a single point.
- Simulink messages are not supported for Floating Scope block and Scope Viewer.
- You cannot connect signals from for-each subsystems.
- Scope displays have limitations in Rapid Accelerator mode. See Behavior of Scopes and Viewers with Rapid Accelerator Mode
Ports
Input
Connect the signals you want to visualize. You can have up to 96 input ports. Input signals can have these characteristics:
- Type — Continuous (sample-based) or discrete (sample-based and frame-based).
- Data type — Any data type that Simulink supports. See Data Types Supported by Simulink.
This block accepts fixed-point input, but converts it todouble
for display. - Dimension — Scalar, one dimensional (vector), two dimensional (matrix), or multidimensional (array). Display multiple channels within one signal depending on the dimension. See Signal Dimensions and Determine Signal Dimensions.
Input Limitations
- When the input is a constant signal, the scope plots a single point.
- The scope shows gaps in the display when the signal value is
NaN
. - When you visualize multiple frame-based signals in the scope, some samples of signals with a frame size of 1 might not be displayed. To visualize these signals, move the signals with frame size of 1 to a separate scope.
Bus Support
You can connect nonvirtual bus and arrays of bus signals to a scope. To display the bus signals, use normal or accelerator simulation mode. The scope displays each bus element signal in the order the elements appear in the bus, from the top to the bottom. Nested bus elements are flattened.
To log nonvirtual bus signals with a scope, set the Save format parameter to Dataset
. You can use any Save format to log virtual bus signals.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
| enumerated
| bus
Complex Number Support: Yes
Properties
Scope Tab
Settings > General
Select this parameter to open the scope window when simulation starts.
Programmatic Use
Specify the dimensions of the display grid as a two-element numeric vector with each element greater than 0 and less than or equal to 16.
Programmatic Use
See LayoutDimensions.
Elements as channels (sample based)
— Process each element of the input as an independent channel.Columns as channels (frame based)
— Process each column of the input as an independent channel. Frame-based processing is available only with discrete input signals.
Dependencies
Frame-based processing requires a DSP System Toolbox license. For more information, see Sample- and Frame-Based Concepts (DSP System Toolbox).
Programmatic Use
See FrameBasedProcessing.
Auto
–– IfTitle and Y-axis label properties are not specified, maximize all plots.On
–– Maximize all plots. Values inTitle and Y-axis label are hidden.Off
–– Do not maximize plots.
Programmatic Use
See MaximizeAxes.
Settings > Time
Specify the length of the _x_-axis to display as one of these:
Auto
— Difference between the simulation start and stop times.
The block calculates the beginning and end times of the time range using the Time display offset and Time span parameters. For example, if you set the Time display offset to10
and theTime span to20
, the scope sets the time range from10
to30
.One frame period
— Use the frame period of the input signal. This option is available only when you set the Input processing parameter toColumns as channels (frame based)
.<user-defined>
— Enter any value less than the total simulation time.
Programmatic Use
See TimeSpan.
Specify how to display data beyond the visible _x_-axis range.
You can see the effects of this option only when plotting is slow with large models or small step sizes.
Wrap
— Draw a full screen of data from left to right, clear the screen, and then restart drawing the data from the left.Scroll
— Move data to the left as new data is drawn on the right. This mode is graphically intensive and can affect run-time performance.
Programmatic Use
Specify the _x_-axis units as one of these options:
Metric (based on Time Span)
— Display time units based on the length of Time span.Seconds
— Display time in seconds.None
— Do not display time units.
Programmatic Use
See TimeUnits.
Offset the _x_-axis by a specified time value, specified as a real number or vector of real numbers.
For input signals with multiple channels, you can enter a scalar or vector:
- Scalar — Offset all channels of an input signal by the same time value.
- Vector — Independently offset the channels.
Programmatic Use
See TimeDisplayOffset.
Specify how the _x_-axis (time) and tick labels display:
All
— Display _x_-axis labels on all _y_-axes.None
— Do not display labels. SelectingNone
also clears the Show time-axis label parameter.Bottom displays only
— Display_x_-axis label on the bottom_y_-axis.
Programmatic Use
See TimeAxisLabels.
Select this parameter to show the time offset on the status bar.
Select this parameter to show the _x_-axis label for the active display.
Dependencies
To enable this parameter, set T-axis and ticks labels toAll
or Bottom displays only
.
Programmatic Use
See ShowTimeAxisLabel.
Settings > Axes Scaling
Specify the _y_-axis scaling mode as one of these:
Manual
— Manually scale the_y_-axis range.Auto
— Scale the _y_-axis range during and after simulation. Selecting this option displays theY-axis limits do not shrink parameter. If you want the y-axis range to increase and decrease with the maximum value of a signal, set Scale Y-axis limits toAuto
and clear the Y axis limits do not shrink parameter.After N Updates
— Scale_y_-axis after the number of time steps specified in theNumber of updates parameter (10
by default). Scaling occurs only once during each run.
Programmatic Use
See AxesScaling.
Select this parameter to allow _y_-axis range limits to increase during simulation.
Dependencies
To use this parameter, set Scale Y-axis limits toAuto
.
Set this property to delay auto scaling the _y_-axis.
Dependencies
To use this parameter, set Scale Y-axis limits toAfter N Updates
.
Programmatic Use
When you select this parameter, the scope scales the _y_-axis limits only when the simulation stops. When you clear this parameter, the scope scales the _y_-axis limits continuously.
Specify the percentage of the _y_-axis range used for plotting data. If you set this parameter to 100
, the plotted data uses the entire _y_-axis range.
Specify where to align plotted data along the _y_-axis data range when Y-axis data range (%) is set to less than 100 percent.
Top
— Align signals with the maximum values of the _y_-axis range.Center
— Center signals between the minimum and maximum values.Bottom
— Align signals with the minimum values of the _y_-axis range.
Scale _x_-axis range to fit all signal values. If Scale Y-axis limits is set to Auto
, the data currently within the axes is scaled, not the entire signal in the data buffer.
Specify the percentage of the _x_-axis range to plot data on. For example, if you set this parameter to 100
, plotted data uses the entire _x_-axis range.
Dependencies
To enable this parameter, select Scale X-axis limits.
Specify where to align plotted data along the _x_-axis data range when X-axis data range (%) is set to less than 100 percent.
Right
— Align signals with the maximum values of the _x_-axis range.Center
— Center signals between the minimum and maximum values.Left
— Align signals with the minimum values of the _x_-axis range.
Dependencies
To enable this parameter, select Scale X-axis limits.
Settings > Logging
Select this property to limit data saved by the scope internally. When you select this property and set the Input processing parameter to:
Elements as channels (sample based)
–– The scope saves the last_n_ data points to a MATLAB® variable specified in Variable name. In this setting, the name of this property is Limit data points to last.Columns as channels (frame based)
–– The scope saves the last_n_ data frames to a MATLAB variable specified in Variable name. In this setting, the name of this property is Limit frames to last.
n is the scalar value you specify in theMax points parameter.
When you select this parameter, the scope can plot signals for less than the entire time range of a simulation, for example, if the sample time is small. If the scope plots only a portion of the signal, consider increasing the number of data points to save.
When you clear this property, the scope saves all the data. You can visualize the entire data in the scope after the simulation finishes. For simulations with Stop Time set toinf
, consider selecting this property.
Note
If you do not select this property and you have a high sample rate or long simulation time, you can run into issues with memory or system performance.
Programmatic Use
See DataLoggingLimitDataPoints.
Specify the maximum number of data points n to save as a positive integer. The scope saves the last n data points to a MATLAB variable specified in Variable name.
Dependencies
To enable this parameter, select the Limit data points to last or the Limit frames to last parameter.
Programmatic Use
See DataLoggingMaxPoints.
Select this property to plot and log (save) scope data every_N_th data point or frame, where_N_ is the decimation factor you specify in theDecimation value parameter.
When you select this property and specify a scalar value in theDecimation value parameter, the scope limits the data values plotted and saved to a MATLAB variable specified in Variable name.
When you set the Input processing parameter to:
Elements as channels (sample based)
–– The scope plots and logs data every _N_th data point. The name of this property is Decimation.Columns as channels (frame based)
–– The scope plots and logs data every _N_th frame. The name of this property is Decimate frames.
When you clear this property, the scope saves all the scope data.
Programmatic Use
See DataLoggingDecimateData and DataLoggingDecimation.
Specify the scope to save or log data every _N_th data point or frame, where N is the value you specify in this parameter.
A value of 1
buffers all the data values.
Dependencies
To enable this parameter, select Decimation or Decimate frames.
Programmatic Use
See DataLoggingDecimateData and DataLoggingDecimation.
Enable or disable logging for viewed signals (excluding signals in model reference, stateflow, and libraries). Right-click on the signal line and open Properties for more logging options.
Settings > Axes Style
Specify the type of the plot as one of these:
Auto
–– The plot type is a line graph for continuous signals, a stair-step graph for discrete signals, and a stem graph for Simulink message signals.Line
–– Line graph.Stairs
–– Stair-step graph. A stair-step graph is made up of only horizontal and vertical lines. Each horizontal line represents the signal value for a discrete sample period and is connected to two vertical lines. Each vertical line represents the change in the signal value occurring at a specific sample time.Stem
–– Stem graph displayed as circles at the input value with vertical lines to the_x_-axis.
Select the background color for the scope display.
Select the axes, grid, and label color for individual displays.
Select the background color for the scope window.
Select this parameter to preserve colors when copying the scope display to the clipboard. When you do not select this parameter, the scope changes the color of the scope to be printer friendly (white background, visible lines). To preserve the existing colors on the scope while copying, select this parameter.
Display Properties
Select the display which updates based on the settings in theDisplay Properties > Line Style, Y-axis, andDisplay.
Specify the desired display using a positive integer that corresponds to the column-wise placement index. For layouts with multiple columns and rows, display numbers are mapped down and then across.
Dependencies
To enable this parameter, set the display grid to have more than one display, that is, set Display grid underSettings > General to a two-element numeric vector with at least one of the values greater than 1.
Programmatic Use
See ActiveDisplay.
Note
All the Line Style properties affect only the active display that you select through the Active Display parameter.
Settings > Line Style
Select the active line for setting line style properties.
Select the line style for the active line that you select using theLine parameter.
Specify the line width for the active line that you select using theLine parameter.
Specify a data point marker for the active line that you select using the Line parameter. This parameter is similar to the 'Marker' property for plots. You can choose any of the marker symbols from the drop-down list.
Specify the line color for the active line that you select using theLine parameter.
Tunable: Yes
Show or hide a signal on the plot.
Select this parameter to display signal on the plot. If you clear this parameter, the signal you select is no longer visible.
Note
All the Y-axis properties affect only the active display that you select through the Active Display parameter.
Settings > Y-axis
Specify the text to display on the _y_-axis. To display signal units, add (%<SignalUnits>)
to the label. At the beginning of a simulation, Simulink replaces (%SignalUnits)
with the units associated with the signals.
Example: For a velocity signal with units of m/s
, enter Velocity (%<SignalUnits>)
.
Dependencies
If you select the Plot as magnitude-phase parameter under Display settings, this parameter does not apply. The _y_-axes are labeledMagnitude
andPhase
.
Programmatic Use
See YLabel.
Specify the _y_-axis limits as a two-element numeric vector.
Tunable: Yes
Dependencies
If you select Plot as magnitude-phase, this property only applies to the magnitude plot. The_y_-axis limits of the phase plot are always[-180 180]
.
Programmatic Use
See YLimits.
Note
All the Display properties affect only the active display that you select through the Active Display parameter.
Settings > Display
Specify the title for the display. The default value%<SignalLabel>
uses the input signal name for the title.
Programmatic Use
See Title.
Select this parameter to display the signal legend. The names listed in the legend are the signal names from the model. For signals with multiple channels, the scope appends a channel index after the signal name. Continuous signals have straight lines before their names, and discrete signals have step-shaped lines.
From the legend, you can control which signals are visible. This control is equivalent to changing the visibility in the Line Style properties. In the scope legend, click a signal name to hide the signal in the scope. To show the signal, click the signal name again. To show only one signal, right-click the signal name, which hides all other signals. To show all signals, press Esc.
Note
The legend only shows the first 20 signals. Any additional signals cannot be controlled from the legend.
Programmatic Use
See ShowLegend.
Select this parameter to show internal grid lines.
Programmatic Use
See ShowGrid.
Select this parameter to split the display into magnitude and phase plots.
- On — Display magnitude and phase plots. If the signal is real, the scope plots the absolute value of the signal for the magnitude. The phase is 0 degrees for positive values and 180 degrees for negative values. This feature is useful for complex-valued input signals. If the input is a real-valued signal, selecting this parameter returns the absolute value of the signal for the magnitude.
- Off — Display signal plot. If the signal is complex, the scope plots the real and imaginary parts on the same _y_-axis.
Programmatic Use
See PlotAsMagnitudePhase.
Display Grid
Specify the layout of the displays. Opens a grid picker similar to the scope layout. The layout can have a maximum of 16 rows and 16 columns.
If the number of displays is equal to the number of ports, signals from each port appear on separate displays. If the number of displays is less than the number of ports, signals from additional ports appear on the last display. For layouts with multiple columns and rows, ports are mapped down then across. If the number of displays is greater than the number of ports, the scope creates empty tiles.
Programmatic Use
See LayoutDimensions.
Dock
Click Dock or Dock Scope in the Scope tab to add the currently active scope to the scope container. Click Dock All Scopes to add all the opened scopes in the current model to the scope container.
For more information on the scope container, see Scope Window Management.
Click Undock in the Home tab of the scope container to remove the currently active scope from the container into a separate stand-alone window. Click Undock All to remove all scopes from the container into separate stand-alone windows.
For more information on the scope container, see Scope Window Management.
Dependencies
This parameter is available only on the Home tab of the scope container.
Select this parameter to add the newly opened scopes (which have not been opened before in the current MATLAB session) automatically to the existing scope container.
For more information on the scope container, see Scope Window Management.
Dependencies
This parameter is available only on the Home tab of the scope container. To access this parameter, click the drop down arrow of Dock All under theHome tab of the scope container.
Measurements Tab
The Measurements tab contains the settings for all the signal measurements that the scope supports. The measurement panels appear at the bottom of the scope UI. To open a measurement panel, you must first enable the corresponding measurement in the Measurements tab.
For more information on the measurements, see these pages:
- Triggers — Set triggers to sync repeating signals and pause the display when events occur.
- Cursor Measurements — Measure signal values using vertical and horizontal cursors.
- Signal Statistics — Display the maximum, minimum, peak-to-peak difference, mean, median, and RMS values of a selected signal.
- Peak Finder — Find maxima, showing the _x_-axis values at which they occur.
- Bilevel Measurements — Measure transitions, overshoots, undershoots, and cycles.
Block Characteristics
Data Types | Boolean | double | enumerated | fixed point | integer | single |
---|---|---|---|---|---|
Direct Feedthrough | no | ||||
Multidimensional Signals | yes | ||||
Variable-Size Signals | yes | ||||
Zero-Crossing Detection | no |
More About
Dock multiple scopes of a Simulink model into a single window called the scope container. The scope container provides a convenient interface from which you can visualize the signals and manage the settings of the scopes. The settings in the Home tab and theMeasurements tab apply only to the active scope, that is, the scope in the container that you are actively interacting with.
Home Tab
The Home tab of the scope container has settings similar to theScope tab of the Scope block toolstrip.
Settings
Click Settings to launch the Style Settings side panel for the currently active scope. In this panel, you can control all the scope related settings, such as general settings, time and axes settings, display settings, style settings, and settings related to logging. For more information on these properties, see Settings in the Scope reference page.
Display Grid
Opens a grid picker similar to the scope layout. The layout can have a maximum of 16 rows and 16 columns.
If the number of displays is equal to the number of ports, signals from each port appear on separate displays. If the number of displays is less than the number of ports, signals from additional ports appear on the last display. For layouts with multiple columns and rows, ports are mapped down then across. If the number of displays is greater than the number of ports, the scope creates empty tiles.
Dock All
Click Dock All to add all the opened scopes in the current model to the scope container. To automatically add newly opened scopes to the existing scope container, select Dock All > Dock New Scopes on Open.
Undock
Click Undock to remove the currently active scope from the container into a separate stand-alone window. When there are multiple scopes docked in the container, click Undock > Undock All to remove all scopes from the container into separate stand-alone windows.
Measurements Tab
The Measurements tab of the scope container has settings similar to the Measurements tab of the Scope block toolstrip.
Extended Capabilities
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
This block can be used for simulation visibility in subsystems that generate HDL code, but is not included in the hardware implementation.
This block can be used for simulation visibility in systems that generate code, but is not included in the generated code.
This block accepts fixed-point input, but converts it to double for display.
Version History
Introduced in R2015b
The SimulinkScope, Time Scope (DSP System Toolbox), and Floating Scope and Scope Viewer blocks in Simulink have a new user interface that you can use to access settings and measurements of the scope. The scope is now more responsive and its performance is improved. Use the new scope container to dock multiple scope windows into a single window and to manage and organize the scopes. The scope container also enables you to view all the scopes in the model in a single window.
Key improvements to the Scope, Time Scope, andFloating Scope and Scope Viewer blocks are:
- Streamlined user interface: Easy access to all the general scope settings from the Scope tab and all the measurement settings from theMeasurements tab of the new scope toolstrip.
- New scope container: A single window providing a unified view for all the scope displays in the model, enabling you to manage and organize multiple scopes in one place.
- Updated settings panel: Updated panel consolidates all general and style settings of the scope. To open the panel, click Settings in the Scope tab of the toolstrip.
The ability to dock the SimulinkScope, Time Scope (DSP System Toolbox), and Floating Scope and Scope Viewer to the MATLAB desktop has been removed. Use the new scope container instead. For more information, see Scope Window Management.
If you have a model created in R2024b or a previous release with four or more open scopes, and you open that model in R2025a, the opened scopes automatically dock in the scope container window.