Simulink.sdi.getGridOn
Description
Examples
Configure Grid for Time Plots in the Simulation Data Inspector
You can use Simulink.sdi.setGridOn
to configure the appearance of the grid for time plots in the Simulation Data Inspector. By default, the Simulation Data Inspector shows horizontal and vertical grid lines.
This example starts by showing how to use Simulink.sdi.getGridOn
to access the current grid configuration. The subsequent sections show the code for each configuration option for time plot grid in the Simulation Data Inspector. To see the result, the example uses a Simulink.sdi.CustomSnapshot
object to specify settings for the output of the SImulink.sdi.snapshot
function.
snapSettings = Simulink.sdi.CustomSnapshot; snapSettings.Width = 300; snapSettings.Height = 300;
Get Initial Grid Setting
Before modifying the grid display preferences, you can save the current configuration to a variable in the workspace in case you want to restore the preferences later.
gridInit = Simulink.sdi.getGridOn;
Configure Horizontal Grid Lines
Show only horizontal grid lines in the Simulation Data Inspector.
Simulink.sdi.setGridOn('horizontal') Simulink.sdi.snapshot('from','custom','settings',snapSettings);
Configure Vertical Grid Lines
Show only vertical grid lines in the Simulation Data Inspector.
Simulink.sdi.setGridOn('vertical') Simulink.sdi.snapshot('from','custom','settings',snapSettings);
Configure No Grid Lines
Show no grid lines in the Simulation Data Inspector.
Simulink.sdi.setGridOn('off') Simulink.sdi.snapshot('from','custom','settings',snapSettings);
Configure Horizontal and Vertical Grid Lines
Show horizontal and vertical grid lines in the Simulation Data Inspector.
Simulink.sdi.setGridOn('on') Simulink.sdi.snapshot('from','custom','settings',snapSettings);
Output Arguments
grid
— Time plot grid configuration
'on'
(default) | 'horizontal'
| 'vertical'
| 'off'
Grid configuration for time plots in the Simulation Data Inspector.
'on'
— Horizontal and vertical grid lines are shown on time plots in the Simulation Data Inspector.'horizontal'
— Only horizontal grid lines are shown on time plots in the Simulation Data Inspector.'vertical'
— Only vertical grid lines are shown on time plots in the Simulation Data Inspector.'off'
— No grid lines are shown on time plots in the Simulation Data Inspector.
Version History
Introduced in R2019aR2019b: Simulink.sdi.getGridOn return values have changed
Starting in R2019b, the Simulink.sdi.getGridOn
return values
changed to:
'on'
'horizontal'
'vertical'
'off'
In R2019a, the Simulink.sdi.getGridOn
returned a logical value:
true
or1
— Horizontal and vertical grid lines are shown on time plots in the Simulation Data Inspector.false
or0
— Horizontal and vertical grid lines are hidden on time plots in the Simulation Data Inspector.
Starting in R2019b, the 'on'
return value is equivalent to the
true
or 1
return, and the 'off'
return value is equivalent to the false
or 0
return.
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)