Main Content

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.

Simulink.sdi.view

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 Simulink.sdi.createRun function.

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.

Visualizations and layouts menu

To plot a route on the map, assign latitude and longitude data.

  1. Select the logan_lat signal.

  2. In the Connect dialog box, select Latitude and click OK.

  3. Select the logan_long signal.

  4. In the Connect dialog box, select Longitude and click OK.

To plot a route, select a signal from the signal table. Then, in the Connect dialog box, select Latitude or Longitude.

Plot Signal Data Alongside Route

Change the subplot layout in the plot area to a 2-by-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 2-by-1 configuration.

The Basic Layouts section of the Visualizations and layouts menu

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.

The top subplot shows a map with a plotted route. The bottom subplot shows the speed over time.

Click the white circle to get more information about the Starting Position.

Details for the Starting Position

To get more information about the Destination, click the red marker.

Details for the Destination

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.

The Show/hide data cursors menu

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.

Two cursors are added to the time plot. In the map, there are two corresponding orange markers.

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.

Moving the data cursor causes the corresponding map marker to change position.

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.

The replay controls are located at the bottom of the window. You can change the speed of the replay using the left and right arrows.

See Also

Tools

Blocks

Functions

Related Topics