Main Content

Simulink.sdi.getCursorOptions

Get current shading options for cursors in Simulation Data Inspector

Since R2024a

    Description

    cursorOpts = Simulink.sdi.getCursorOptions returns the current shading configuration for cursors in the Inspect pane of the Simulation Data Inspector. Configuration options include the area to shade, the color and opacity of the shaded region, and whether signal data is emphasized in the shaded region.

    example

    cursorOpts = Simulink.sdi.getCursorOptions(Type=pane) returns the shading configuration for cursors in either the Inspect or Compare pane of the Simulation Data Inspector.

    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 in 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

    Where to get cursor options configuration from, specified as one of these options:

    • "Inspect" — Get cursor shading configuration from the Inspect pane of the Simulation Data Inspector.

    • "Compare" — Get cursor shading configuration from the Compare pane of the Simulation Data Inspector.

    Output Arguments

    collapse all

    Cursor shading configuration, returned as a structure with these fields specifying the current cursor options:

    • shadeType — Whether the signal data is emphasized in shaded region, returned as 'emphasize' or 'deemphasize'.

    • shadeArea — Shaded area relative to cursors, returned as one of these options:

      • 'none' — Plot area not shaded.

      • 'lead' — Plot area that leads the left-most cursor is shaded.

      • 'lag' — Plot area that lags the right-most cursor is shaded.

      • 'leadandlag' — When two cursors are displayed, plot area outside of the cursors is shaded.

      • 'inbetween' — When two cursors are displayed, plot area between the cursors is shaded.

    • shadeColor — Color of the shaded area, returned as a hexadecimal color code.

    • shadeOpacity — Opacity of the shaded area, returned as a percentage value between 0 and 1.

    Version History

    Introduced in R2024a