View and Replay Map Data

You can add a map to your layout in the Simulation Data Inspector to view routes of longitude and latitude data. The map data is synchronized with signal data in the Simulation Data Inspector, allowing you to analyze signal activity throughout the route. To analyze the relationship between the route and signal values, you can replay the data. When you replay data in the Simulation Data Inspector, synchronized cursors and markers move across the plots in the view.

To view map data in the Simulation Data Inspector, you must have an active internet connection.

If your model includes latitude and longitude signals, you can log data to the Simulation Data Inspector and visualize it during simulation. You can also import the data from the workspace or a file using the instructions in Import Data from the Workspace or a File or the Simulink.sdi.createRun function. For this example, import a file of recorded map and speed data using Simulink.sdi.createRun. Then, open the Simulation Data Inspector.

mapRun = Simulink.sdi.createRun('LoganTrip','file','logan_ah_gps_data.xlsx');
Simulink.sdi.view

View Map Data

Configure the plot area in a 2x1 layout so you can view the speed data and map data together. To plot the speed data on the lower plot, select the plot and then select the check box next to the speed signal. To add a map to the layout, open the Visualization Gallery by clicking Edit View on the Layout menu.

From the visualization gallery, drag a map onto the top subplot in the layout. Check the logan_lat signal and click OK on the dialog in the bottom-right of the map to use the signal to specify the latitude data on the map.

Then, check the logan_long signal and click OK to use the signal as longitude data on the map.

You can also plot map data by selecting multiple signals while holding Ctrl and then dragging those signals onto the map. The menu in the lower-right shows drop-downs you can use to specify which signal to use for the latitude data and which to use for the longitude data.

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 cursors button in the toolbar and select Two Cursors. 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 East to West with time.

To remove the cursors from the plot, click the Show/hide data cursors button.

Replay Map Data

You can replay data in the Simulation Data Inspector to automate moving cursors across the visualizations in your view. To add the replay controls to the view, click the Show/hide replay controls button.

Then, press the Replay button.

A data marker on the map and a cursor on the time plot sweep synchronously across the screen. The synchronous replay facilitates an intuitive understanding of the relationship between speed and position throughout the trip.

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.

For another example, see Replay Data in the Simulation Data Inspector.

Related Topics

View Data in the Simulation Data Inspector

Create Plots Using the Simulation Data Inspector