Main Content

Simulink.sdi.setCursorOptions

Configure shading options for cursors in Simulation Data Inspector

Since R2020a

    Description

    Simulink.sdi.setCursorOptions(Name,Value) configures shading options for cursors in the Simulation Data Inspector according to one or more name-value pair arguments. For example, 'ShadeArea','InBetween' configures the Simulation Data Inspector to apply shading to the area between two cursors. You can specify name-value pair arguments to configure the area to shade, the color and opacity of the shaded region, and whether signal data is emphasized in the shaded region.

    example

    Examples

    collapse all

    You can configure shading options for cursors to draw attention to a region of interest in a time plot. You can choose to emphasize or de-emphasize the signal data in the shaded region, and you can specify the shading color and opacity. By default, the Simulation Data Inspector shades areas gray with an opacity of 0.7 to de-emphasize signal data and shades areas light blue with an opacity of 0.7 when signal data is emphasized.

    Suppose you want to highlight a signal transition by shading the area where the transition occurs a light yellow. Configure the cursors to highlight the area between the cursors a light yellow color.

    Simulink.sdi.setCursorOptions('Emphasize',true,...
      'ShadeArea','InBetween','ShadeColor',[1 1 0.6]);

    To programmatically see the current cursor shading configuration, use the Simulink.sdi.getCursorOptions function.

    colorOpts = Simulink.sdi.getCursorOptions
    colorOpts = 
    
      struct with fields:
    
           shadeType: 'emphasize'
           shadeArea: 'inbetween'
          shadeColor: '#ffff99'
        shadeOpacity: 0.9000

    Input Arguments

    collapse all

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: 'ShadeArea','Lead','ShadeOpacity',0.5 configures cursors to shade the area that leads the left-most cursor with an opacity of 0.5.

    Where to apply cursor options, specified as the name-value pair consisting of 'Type' and 'Inspect' or 'Compare'. You can configure independent cursor options for the Inspect and Compare panes in the Simulation Data Inspector.

    Example: 'Type','Compare' configures cursor options for the Compare pane.

    Whether signal data is emphasized in shaded region, specified as the name-value pair consisting of 'Emphasize' and true or false. When emphasized, the signal data is plotted on top of the cursor shading.

    Example: 'Emphasize',false configures cursor options to plot signal data under shaded region.

    Area to shade relative to cursors, specified as the name-value pair consisting of 'ShadeArea' and one of these options:

    • 'none' — Do not shade any plot area.

    • 'lead' — Shade the plot area that leads the left-most cursor.

    • 'lag' — Shade the plot area that lags the right-most cursor.

    • 'leadandlag' — Shade the plot area outside of the cursors, when two cursors are displayed.

    • 'inbetween' — Shade the plot area between the cursors, when two cursors are displayed.

    Example: 'ShadeArea','none' configures cursor options to not shade any region relative to the cursors.

    Color of the shaded area, specified as the name-value pair consisting of 'ShadeColor' and an r g b vector with values between 0 and 1.

    Example: 'ShadeColor',[0 0 1] configures the color of the shaded area as blue.

    Opacity of the shaded area, specified as the name-value pair consisting of 'ShadeOpacity' and a percentage value between 0 and 1.

    Example: 'ShadeOpacity',0.5 configures the opacity of the shaded area as 0.5.

    Version History

    Introduced in R2020a