Main Content

Simulink.sdi.getTicksPosition

Get tick mark position setting for time plots

Since R2019b

Description

example

ticksPos = Simulink.sdi.getTicksPosition returns the current setting for the position of tick marks on time plots in the Simulation Data Inspector. The return value corresponds to the value of the Ticks 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 marks on the outside of the plot area for time plots.

Examples

collapse all

You can use Simulink.sdi.setTicksPosition function to specify the position for tick marks on time plots in the Simulation Data Inspector. By default, the Simulation Data Inspector displays tick marks outside of the plot area for time plots.

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

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

Get Current Tick Mark Position

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

initTickPos = Simulink.sdi.getTicksPosition;

Position Tick Marks Inside Plot Area

Position the tick marks inside the plot area to increase the amount of space used by the plot area.

Simulink.sdi.setTicksPosition('inside')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

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

Hide Tick Marks on Time Plots

You can hide the tick marks for time plots in the Simulation Data Inspector. Hiding the tick marks expands the plot area.

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

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

Position Tick Marks Outside Plot Area

By default, the Simulation Data Inspector displays tick marks outside of the plot area for time plots.

Simulink.sdi.setTicksPosition('outside')
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

Current setting for the position of tick marks on time plots in the Simulation Data Inspector, returned as 'inside' or 'outside'.

Version History

Introduced in R2019b