Simulink.sdi.setVisualization
Description
Examples
Programmatically Set Visualization Type in Simulation Data Inspector
Suppose you want to visualize route and speed data in the Simulation Data
using a map visualization, an XY plot of the longitude and latitude data, and a time
plot of the speed data. You can use the
Simulink.sdi.setVisualization
function and the
Simulink.sdi.getVisualization
function to programmatically set
and get the visualization type for a subplot. For more information about the route and
speed data used in this example, see View and Replay Map Data.
When subplots are in a grid layout, use the row and column indexing of each subplot to set the visualization type. For example, using a 3-by-1 subplot layout, set the top subplot to a map visualization, the middle subplot to an XY plot, and the bottom subplot to a time plot. Then, plot the data.
Simulink.sdi.setVisualization(1,1,"map"); Simulink.sdi.setVisualization(2,1,"xy"); Simulink.sdi.setVisualization(3,1,"timeplot");
You can also set the visualization type when using a split three-plot basic layout. For example, using a split top three-plot layout, set the top-left subplot to an XY plot, the top-right subplot to a time plot, and the bottom subplot to a map. Then, plot the data.
Simulink.sdi.setVisualization(1,1,"xy"); Simulink.sdi.setVisualization(1,2,"timeplot"); Simulink.sdi.setVisualization(2,1,"map");
When you use an overlay subplot layout, the indexing remains the same regardless of the orientation. Consider an overlay layout with the overlays located at the top of the main subplot. Set the main subplot to a map visualization, the top-left overlay to an XY plot, and the top-right overlay to a time plot.
Simulink.sdi.setVisualization(1,1,"map"); Simulink.sdi.setVisualization(1,2,"timeplot"); Simulink.sdi.setVisualization(2,1,"xy");
Change the position of the overlays so that they are on the right side of the main plot.
Use the Simulink.sdi.getVisualization
function to get the visualization
type for each subplot.
mapVis = Simulink.sdi.getVisualization(1,1) xyVis = Simulink.sdi.getVisualization(2,1) timeVis = Simulink.sdi.getVisualization(1,2)
mapVis = 'map' xyVis = 'xy' timeVis = 'timeplot'
Input Arguments
r
— Subplot row index
integer
Subplot row index, specified as an integer between 1
and
8
, inclusive. Use the r
and c
inputs together to specify the location of the subplot for which you want to get the
visualization type. For more information about how the Simulation Data Inspector indexes
subplots, see Moving Between Subplot Layouts.
c
— Subplot column index
integer
Subplot column index, specified as an integer value between 1
and
8
, inclusive. Use the r
and c
inputs together to specify the location of the subplot for which you want to get the
visualization type. For more information about how the Simulation Data Inspector indexes
subplots, see Moving Between Subplot Layouts.
visType
— Visualization type
"timeplot"
| "array"
| "map"
| "sparklines"
| "xy"
| "text-editor"
Visualization type, specified as one of these plotting options:
"timeplot"
— Signal data as a function of time"array"
— Multidimensional data"map"
— Route on a map"sparklines"
— Many signals at once"xy"
— Relationships between time-aligned signals"text-editor"
— Rich text editor
For more information about the visualization types, see Create Plots Using the Simulation Data Inspector.
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)