Main Content


Import file into RoadRunner Scenario using MATLAB

Since R2022a


    importScenario(rrApp,filename,formatname) imports an ASAM OpenSCENARIO® file or a trajectory in a CSV file into the currently opened scenario.


    importScenario(rrApp,filename,formatname,importoptions) sets additional import options using importoptions argument. This syntax is valid only when importing an ASAM OpenSCENARIO file.


    collapse all

    Import a scenario in RoadRunner Scenario using MATLAB.

    Call the roadrunner function and pass in the location where you want to create the project. This example assumes that RoadRunner is installed in its default location in Windows.

    Specify the path to an existing project. For example, this code shows the path to a project located at "C:\RR\MyProject". This call returns an object rrApp that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

    projectFolder = "C:\RR\MyProject";
    rrApp = roadrunner(projectFolder);

    Open a new scenario in the current project by calling the newScenario function and passing it the rrApp object. This call opens a blank scenario in the currently opened project.


    Before importing the ASAM OpenSCENARIO® file, set import options by creating an openScenarioImportOptions object to enable import of signals from the file.

    options = openScenarioImportOptions(OpenDriveOptions = openDriveImportOptions(ImportSignals=true));

    Call the importScenario function and pass the rrApp object, the filename, and the options object as input arguments. This function call imports data from the specified filename into the currently opened scenario.

    filename = "C:\RR\MyProject\Assets\FourWaySignal.xosc";
    formatname = "OpenSCENARIO";

    Input Arguments

    collapse all

    RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common workflow tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

    Path of file which is to be imported, specified as a character vector or string scalar. filename is absolute or relative path to the file to be imported. If you specify a relative path, then you must specify a path to a file in the Assets folder of the current project.

    Example: While calling importScenario(rrApp,"C:\RR\MyProject\Assets\FourWaySignal.xosc","OpenSCENARIO",importoptions), "C:\RR\MyProject\Assets\FourWaySignal.xosc" represents the file path of the file to be imported, which is relative to the Assets folder of the current project.

    Data Types: char | string

    Import format name, specified as "OpenSCENARIO" or "CSV Trajectory". Format name options are case-insensitive.

    • "OpenSCENARIO" — Import ASAM OpenSCENARIO file

    • "CSV Trajectory" — Import vehicle trajectory from a CSV file

    Example: While calling importScenario(rrApp,"C:\RR\MyProject\Assets\FourWaySignal.xosc","OpenSCENARIO",importoptions), OpenSCENARIO specifies that the file will be imported to ASAM OpenSCENARIO format.

    Data Types: char | string

    Import options configuration, specified as an openScenarioImportOptions object compatible with the file specified in the filename argument. You can specify this argument only when the value of formatname is "OpenSCENARIO".

    Import Format Options ObjectDescription Properties

    Specifies options for importing ASAM OpenSCENARIO file into RoadRunner scenario.

    openScenarioImportOptions (Name=Value) creates an import options configuration object for the ASAM OpenSCENARIO format with properties specified as one or more name-value arguments. If a default property value is "auto", the RoadRunner application determines what value to use and sets the property to that value.


    Options to import an ASAM OpenDRIVE® file, specified as an openDriveImportOptions object.

    Default: "auto".

    Example: options = openScenarioImportOptions(OpenDriveOptions = openDriveImportOptions(ImportSignals=true));

    Version History

    Introduced in R2022a