Simulink.sdi.setTickLabelsDisplay

Configure tick label visibility for time plot axes

Description

example

Simulink.sdi.setTickLabelsDisplay(label) displays labels for the tick marks on axes of time plots in the Simulation Data Inspector according to the input, label. The function sets the value of the Tick labels setting in the Simulation Data Inspector Time Plot Settings. The setting applies to all time plots in the layout. By default, the Simulation Data Inspector displays tick mark labels for both time plot axes.

Examples

collapse all

You can use the Simulink.sdi.setTickLabelsDisplay function to configure the visibility of tick mark labels for the t- and y-axes on time plots in the Simulation Data Inspector. By default, the Simulation Data Inspector displays tick marks for both axes.

This example starts by showing how to use the Simulink.sdi.getTickLabelsDisplay function to access the current tick mark label visibility. Subsequent sections show the code to specify each available option for tick mark label visibility on time plots in the Simulation Data Inspector. To see the result of each configuration, the example generates an image useing the Simulink.sdi.snapshot function with settings specified by a Simulink.sdi.CustomSnapshot object.

snapSettings = Simulink.sdi.CustomSnapshot;
snapSettings.Width = 300;
snapSettings.Height = 300;

Get Current Tick Mark Label Visibility

Before modifying the visibility of the tick mark labels on time plots, you can save the current configuration to a variable in the workspace in case you want to restore the preference later.

initTickLabels = Simulink.sdi.getTickLabelsDisplay;

Show Only t-Axis Tick Mark Labels

Show the tick mark labels for the t-Axis.

Simulink.sdi.setTickLabelsDisplay('t-axis')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Show Only y-Axis Tick Mark Labels

Show the tick mark labels for the y-axis.

Simulink.sdi.setTickLabelsDisplay('y-axis')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Hide Tick Mark Labels

You can hide the tick mark labels for both axes.

Simulink.sdi.setTickLabelsDisplay('none')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Show All Tick Mark Labels

By default, the Simulation Data Inspector shows tick mark labels for both axes on time plots.

Simulink.sdi.setTickLabelsDisplay('all')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Input Arguments

collapse all

Specify tick mark labels to display on time plots in the Simulation Data Inspector.

  • 'all' — Display tick mark labels for both time plot axes.

  • 't-axis' — Display tick mark labels only on the t-axis for time plots.

  • 'y-axis' — Display tick mark labels only on the y-axis for time plots.

  • 'none' — Do not display tick mark labels.

Introduced in R2019b