Documentation Center

  • Trial Software
  • Product Updates

Simulink.scopes.TimeScopeConfiguration class

Package: Simulink.scopes

Configure Time Scope for programmatic access

Description

The Simulink.scopes.TimeScopeConfiguration object contains the scope configuration information for the Time Scope block.

Construction

Call the get_param function, specifying a Time Scope block.

htsc = get_param(gcbh,'ScopeConfiguration') constructs a new Time Scope Configuration object.

Properties

ActiveDisplay

Active display for display-specific properties

Specify the active display as an integer to get and set relevant properties. The number of a display corresponds to its column-wise placement index. Set this property to control which display should have its axes colors, line properties, marker properties, and visibility changed. Tunable

Setting this property controls which display is used for ShowGrid, ShowLegend, Title, PlotAsMagnitudePhase, YLabel, and YLimits.

Default: 1

AxesScaling

Specify how axes should be scaled when plotting data

Specify when the scope should automatically scale the axes. You can select one of the following options:

  • Manual — When you select this option, the scope does not automatically scale the axes. You can manually scale the axes in any of the following ways:

    • Select Tools > Axes Scaling Properties.

    • Press one of the Scale Axis Limits toolbar buttons.

    • When the scope figure is the active window, press Ctrl and A simultaneously.

  • Auto — When you select this option, the scope scales the axes as needed, both during and after simulation. Selecting this option shows the Do not allow Y-axis limits to shrink check box.

  • After N Updates — Selecting this option causes the scope to scale the axes after a specified number of updates. Selecting this option shows the Number of updates edit box.

By default, this property is set to Auto. This property is Tunable.

BufferLength

Number of data points in buffer

Specify the size of the buffer that the scope holds in its memory cache. If your signal has M rows of data and N data points in each row, M x N is the number of data points per time step. Multiply this result by the number of time steps for your model to obtain the required buffer length. For example, if you have 10 rows of data with each row having 100 data points and your run will be 10 time steps, you should enter 10,000 (which is 10 x 100 x 10) as the buffer length.

Default: 50000

DataLogging

Specify whether to log data to the workspace

Set this property to true to log data to the workspace. Data is logged as a dataset object. See Simulink.SimulationData.Dataset for information. Set this property to false to prevent the scope from logging data.

Default: false

DataLoggingVariableName

Name of variable for logged data

Specify as a string the name of the variable in the MATLAB® workspace to which the scope logs data. Any existing variable is overwritten.

Default: ScopeData

DataLoggingLimitDataPoints

Specify whether to limit number of logged data points

Set this property to true to limit the number of data points at the end of the simulation data that the scope logs. Set this property to false to log all data points.

Default: false

DataLoggingMaxPoints

Maximum number of data points to log

Specify the maximum number of data points at the end of the data to log to the workspace.

Default: 5000

DataLoggingDecimateData

Specify whether to decimate logged data

Set this property to true to decimate logged data. Set this property to false to log all data points.

Default: false

DataLoggingDecimation

Logged data decimation rate

Specify the rate at which to log decimation data. The scope logs every Nth data point, where N is the decimation factor you specify.

Default: 2

LayoutDimensions

Layout grid dimensions

Specify the layout grid dimensions as a 2-element vector: [numberOfRows, numberOfColumns]. You can use no more than four rows or four columns. This property is Tunable.

Default: [1,1]

MaximizeAxes

Maximize axes control

Specify whether to display the scope in maximized axes mode. In this mode, each of the axes is expanded to fit into the entire display. To conserve space, labels do not appear in each display. Instead, tick-mark values appear on top of the plotted data. You can select one of the following options:

  • Auto — In this mode, the axes appear maximized in all displays only if the Title and YLabel properties are empty for every display. If you enter any value in any display for either of these properties, the axes are not maximized.

  • On — In this mode, the axes appear maximized in all displays. Any values entered into the Title and YLabel properties are hidden.

  • Off — In this mode, none of the axes appear maximized.

This property is Tunable.

Default: 'Auto'

Name

Caption to display on the Time Scope window

Specify as a string the caption to display on the scope window. This property is Tunable.

Default: 'Time Scope'

NumInputPorts

Number of input signals

Specify the number of input signals to display on the scope as a positive integer. You must invoke the step method with the same number of inputs as the value of this property.

Default: 1

OpenAtSimulationStart

Open the scope when starting the simulation

Set this property to true to open the scope when the simulation starts. Set this property to false to prevent the scope from opening at the start of simulation.

Default: true

PlotAsMagnitudePhase

Plot signal magnitude and phase

When you set this property to true, the scope plots the magnitude and phase of the input signal on two separate axes within the same active display. When you set this property to false, the scope plots the real and imaginary parts of the input signal on two separate axes within the same active display. This property is particularly useful for complex-valued input signals. Selecting this check box affects the phase for real-valued input signals. When the amplitude of the input signal is nonnegative, the phase is 0 degrees. When the amplitude of the input signal is negative, the phase is 180 degrees. This property is Tunable.

When set, ActiveDisplay controls which displays are updated. The active display shows the magnitude of the input signal on the top axes and its phase, in degrees, on the bottom axes.

Default: false

Position

Time Scope window position in pixels

Specify, in pixels, the size and location of the scope window as a 4-element double vector of the form, [left bottom width height]. You can place the scope window in a specific position on your screen by modifying the values to this property. This property is Tunable.

Default: The default depends on your screen resolution. By default, the Time Scope window appears in the center of your screen with a width of 410 pixels and height of 300 pixels.

ShowGrid

Option to enable or disable grid display

When you set this property to true, the grid appears. When you set this property to false, the grid is hidden. This property is Tunable.

When set, ActiveDisplay controls which display is updated.

Default: false

ShowLegend

When you set this property to true, the scope displays a legend with automatic string labels for each input channel. When you set this property to false, the scope does not display a legend. This property applies only when you set the SpectrumType property to 'Power' or 'Power density'. This property is Tunable.

See FrameBasedProcessing for information on input channels.

When set, ActiveDisplay controls which display is updated.

Default: false

TimeAxisLabels

Time-axis labels

Specify how time-axis labels should appear in the scope displays as one of 'All', 'Bottom, or 'None'.

  • When you set this property to 'All', time-axis labels appear in all displays.

  • When you set this property to 'Bottom', time-axis labels appear in the bottom display of each column.

  • When you set this property to 'None', there are no labels in any displays.

This property is Tunable.

Default: 'All'

TimeDisplayOffset

Time display offset

Specify the offset, in seconds, to apply to the time-axis. This property can be either a numeric scalar or a vector of length equal to the number of input channels. If you specify this property as a scalar, then that value is the time display offset for all channels. If you specify a vector, each vector element is the time offset for the corresponding channel. For vectors with length less than the number of input channels, the time display offsets for the remaining channels are set to 0. If a vector has a length greater than the number of input channels, the extra vector elements are ignored. This property is Tunable.

See FrameBasedProcessing for information on input channels. See TimeSpan and TimeSpanSource for information on the x-axis limits and time span settings.

Default: 0

TimeSpan

Time span

Specify the time span, in seconds, as a positive, numeric scalar value. This property applies when FrameBasedProcessing is false. This property also applies when FrameBasedProcessing is true and TimeSpanSource is Property. The time-axis limits are calculated as follows.

  • Minimum time-axis limit = min(TimeDisplayOffset)

  • Maximum time-axis limit = max(TimeDisplayOffset) + TimeSpan

where TimeDisplayOffset and TimeSpan are the values of their respective properties. This property is Tunable.

Default: 10

TimeSpanOverrunAction

Wrap or scroll when the TimeSpan value is overrun

Specify how the scope displays new data beyond the visible time span. You can select one of the following options:

  • Wrap — In this mode, the scope displays new data until the data reaches the maximum time-axis limit. When the data reaches the maximum time-axis limit of the scope window, the scope clears the display. The scope then updates the time offset value and begins displaying subsequent data points starting from the minimum time-axis limit.

  • Scroll — In this mode, the scope scrolls old data to the left to make room for new data on the right side of the scope display. This mode is graphically intensive and can affect run-time performance. However, it is beneficial for debugging and monitoring time-varying signals.

This property is Tunable.

Default: 'Wrap'

TimeUnits

Units of the time-axis

Specify the units used to describe the time-axis. You can select one of the following options:

  • Metric — In this mode, the scope converts the times on the time-axis to the most appropriate measurement units. These can include milliseconds, microseconds, nanoseconds, minutes, days, etc. The scope chooses the appropriate measurement units based on the minimum time-axis limit and the maximum time-axis limit of the scope window.

  • Seconds — In this mode, the scope always displays the units on the time-axis as seconds.

  • None — In this mode, the scope does not display any units on the time-axis. The scope only shows the word Time on the time-axis.

This property is Tunable.

Default: 'Metric'

Title

Display title

Specify the display title as a string. Enter %<SignalLabel> to use the signal labels in the Simulink Model as the axes titles. This property is Tunable.

When set, ActiveDisplay controls which display is updated.

Default: ''

YLabel

The label for the y-axis

Specify as a string the text for the scope to display to the left of the y-axis. Tunable

This property applies only when PlotAsMagnitudePhase is false. When PlotAsMagnitudePhase is true, the two y-axis labels are read-only values. The y-axis labels are set to 'Magnitude' and 'Phase' for the magnitude plot and the phase plot, respectively. When set, ActiveDisplay controls which display is updated.

Default: 'Amplitude' if PlotAsMagnitudePhase is false

YLimits

The limits for the y-axis

Specify the y-axis limits as a 2-element numeric vector, [ymin ymax]. This property is Tunable.

When PlotAsMagnitudePhase is true, this property specifies the y-axis limits of only the magnitude plot. The y-axis limits of the phase plot are always [-180, 180]. When set, ActiveDisplay controls which display is updated.

Default: [-10, 10], if PlotAsMagnitudePhase is false, or [0, 10], if PlotAsMagnitudePhase is true.

Examples

expand all

Example: Construct a Time Scope Configuration Object

Create a new Simulink® model with a randomly-generated name.

sysname=char(randi(26,1,7)+96);
new_system(sysname);

Add a new Time Scope block to the model.

add_block('built-in/TimeScope',[sysname,'/TimeScope'])

Call the get_param function to retrieve the default Time Scope block properties.

htsc = get_param([sysname,'/TimeScope'],'ScopeConfiguration')
ans = 

  TimeScopeConfiguration with properties:

                     Name: 'TimeScope'
            NumInputPorts: '1'
             BufferLength: '50000'
    OpenAtSimulationStart: 0
                 Position: [755 450 410 300]
             MaximizeAxes: 'Auto'
              AxesScaling: 'Manual'
                 TimeSpan: 'Auto'
    TimeSpanOverrunAction: 'Wrap'
                TimeUnits: 'none'
        TimeDisplayOffset: '0'
           TimeAxisLabels: 'Bottom'
         LayoutDimensions: [1 1]
            ActiveDisplay: 1
                    Title: ''
               ShowLegend: 0
                 ShowGrid: 1
     PlotAsMagnitudePhase: 0
                  YLimits: [-10 10]
                   YLabel: 'Amplitude'
Was this topic helpful?