Main Content

Simulink.sdi.getTickLabelsDisplay

Get tick mark label setting for time plots

Since R2019b

Description

example

tickLabels = Simulink.sdi.getTickLabelsDisplay returns the current setting for displayed tick mark labels on time plots in the Simulation Data Inspector. The return value corresponds to the value of the Tick labels setting on the Time Plot section of the Visualization Settings in the Simulation Data Inspector. The setting applies to all time plots in the layout. By default, the Simulation Data Inspector displays tick mark labels for both axes on time plots.

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 using 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);

Figure contains an axes object. The axes object contains an object of type image.

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);

Figure contains an axes object. The axes object contains an object of type image.

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);

Figure contains an axes object. The axes object contains an object of type image.

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);

Figure contains an axes object. The axes object contains an object of type image.

Output Arguments

collapse all

Time plot axes that display tick mark labels in the Simulation Data Inspector, returned as one of these options:

  • 'all' — Tick mark labels displayed for both time plot axes.

  • 't-axis' — Tick mark labels displayed only on the t-axis for time plots.

  • 'y-axis' — Tick mark labels displayed only on the y-axis for time plots.

  • 'none' — No tick mark labels displayed on time plots.

Version History

Introduced in R2019b