Main Content

updatePlots

Update driving scenario plots

Description

example

updatePlots(scenario) updates the display of all existing plots for the driving scenario, scenario. Driving scenario plots are automatically updated every time you call the advance function to advance the simulation. Use updatePlots after you update any actor properties and want to refresh the plot without having to call advance.

Examples

collapse all

Update driving scenario plots after changing the vehicle position in a scenario.

Create a driving scenario containing a vehicle on a straight, 25-meter road segment. Plot the scenario.

scenario = drivingScenario;
roadcenters = [0 0 0; 25 0 0];
road(scenario,roadcenters);
  
v = vehicle(scenario,'ClassID',1);
v.Position = [1 0 0];

plot(scenario)

Use a chase plot to plot the scenario from the perspective of the vehicle.

chasePlot(v)

Set a new position for the vehicle.

v.Position = [12 0 0];

Update both plots to show the new position of the vehicle.

updatePlots(scenario)

Input Arguments

collapse all

Driving scenario, specified as a drivingScenario object.

Version History

Introduced in R2017a