View and Replay Map Data
This example shows how to use the map visualization in the Simulation Data Inspector to view routes of longitude and latitude data. The map data is synchronized with signal data, which allows you to analyze signal activity throughout the route by adding cursors and by replaying the data.
The map visualization used in this example is also available in the Record block. When you use the map visualization in the Record block, you add the visualization and configure the appearance using the toolstrip. You plot data on the map the same way shown in this example.
To view map data in the Simulation Data Inspector or Record block, you must have an active internet connection.
Import Route Data into Simulation Data Inspector
If your model includes latitude and longitude signals, you can view logged data on the map during simulation. You can also import data from the workspace or a file.
Open the Simulation Data Inspector.
The data for this example is stored in the Excel™ file
LoganTripGPSData.xlsx. To import the data using the user interface, click Import .
In the Import dialog box, under Import from, select File. Then, enter
LoganTripGPSData.xlsx in the text box and click Import.
Alternatively, import the data programmatically using the
mapRun = Simulink.sdi.createRun("LoganTrip","file","LoganTripGPSData.xlsx");
Plot Route on Map
By default, the Simulation Data Inspector uses time plots for each subplot in the layout. To plot data on a map, you need to add the visualization to the layout.
To add a map to your layout, click Visualizations and layouts . Then, click or drag the Map icon from Visualizations onto the subplot.
To plot a route on the map, assign latitude and longitude data.
In the Connect dialog box, select Latitude and click OK.
In the Connect dialog box, select Longitude and click OK.
Plot Signal Data Alongside Route
Change the subplot layout in the plot area to a
1 layout so you can plot the speed data alongside the route. Click Visualizations and Layouts . Then, under Basic Layouts, select the subplot layout in a
To plot the speed data on the bottom subplot, select the subplot, then select the check box next to the
speed signal in the table.
Click the white circle to get more information about the Starting Position.
To get more information about the Destination, click the red marker.
Analyze Data Using Cursors
You can add cursors to the plots to analyze the relationship between the
speed signal and the route shown on the map. To add two cursors to the layout, click the drop-down arrow on the Show/hide data cursors button and select Two Cursors.
When you add cursors, additional orange markers appear on the map. The Starting Position and the Destination for the route have static markers. An additional marker corresponds to each cursor in the time plot.
In the lower subplot, move the cursor on the left. The marker on the right of the map moves as you move the left cursor because the route starts in Boston and moves from east to west over time.
To remove the cursors from the plot, click Show/hide data cursors .
Replay Route and Signal Data
In the Simulation Data Inspector, you can replay data to analyze relationships among plotted signals in your view. When you replay data in the Simulation Data Inspector, animated cursors sweep through the plotted data from the start time to the end time. To add the replay controls to the view, click Show/hide replay controls . Then, click Replay .
A marker on the map and a cursor on the time plot sweep synchronously across the screen. By default, the Simulation Data Inspector replays data at one second per second, meaning that the cursor moves through one second of data in one second of clock time. The data for this trip spans approximately 34 minutes. You can increase the replay speed using the arrow to the right of the label or by clicking the label and typing the desired speed. Increase the replay speed to
32x using the arrow.