Main Content


Extract properties from input scenario to generate scenario variants



D = getScenarioDescriptor(scenario,Simulator=simulator) extracts the properties of an input scenario and stores these properties in a ScenarioDescriptor object, D, for scenario variant generation. simulator specifies the simulator used by the input scenario scenario.


This function requires the Scenario Variant Generator for Automated Driving Toolbox™ support package. You can install Scenario Variant Generator for Automated Driving Toolbox from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.


collapse all

Create a driving scenario.

scenario = drivingScenario;

Add a road segment to the scenario.

roadCenters = [41 6; 7 6];
laneSpecification = lanespec([2 2]);
road(scenario,roadCenters, ...

Create a trajectory by adding an ego vehicle, waypoints, and speed information to the scenario.

egoVehicle = vehicle(scenario, ...
    ClassID=1, ...
    Position=[13 4 0], ...
    Mesh=driving.scenario.carMesh, ...
waypoints = [13 4 0;
             30 4 0;
             41 4 0];
speed = 30;

Create a scenarioDescriptor object, and display it.

scenarioDescriptor = getScenarioDescriptor(scenario,Simulator="DrivingScenario")
scenarioDescriptor = 
  ScenarioDescriptor with properties:

    status: "DescriptorCreated"

Recreate the scenario as a drivingScenario object.

scenarioDS = getScenario(scenarioDescriptor,Simulator="DrivingScenario");

Input Arguments

collapse all

Seed scenario, specified as a drivingScenario object.

Simulator name of the seed scenario, specified as "DrivingScenario". Currently, this function supports only the MATLAB® driving scenario simulator.

Data Types: char | string

Output Arguments

collapse all

Scenario descriptor, returned as a ScenarioDescriptor object. The status property of the descriptor object D indicates "DescriptorCreated" whether the object has been successfully created.

The ScenarioDescriptor object stores scene, actor, and vehicle information extracted from a seed scenario. You can use these scene information to generate scenario variants to perform safety assessments for various automated driving applications.


  • To get a scenario from a ScenarioDescriptor object, use the getScenario function.

Version History

Introduced in R2022b