exportScenario
Syntax
Description
exportScenario(
exports a scenario file to one of the file formats that RoadRunner supports.rrApp
,filename
,formatname
)
exportScenario(
sets options for export using rrApp
,filename
,formatname
,exportoptions
)exportoptions
. The export options
configuration is specified as one of the export options objects compatible with the format
name specified in the formatname
argument. You can export only
ASAM OpenSCENARIO® files.
Examples
Export Scenario
Export a scenario from 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 scenario in the project by calling the openScenario
function. You must pass the rrApp
object and the RoadRunner scenario you wish to open as input arguments while calling the openScenario
function. This example uses the 'FourWaySignal.rrscenario'
scenario, which is one of the scenario included by default in RoadRunner projects and
is located in the Scenarios
folder of the project.
scenarioname = "MyScenario.rrscenario";
openScenario(rrApp,scenarioname);
Before exporting the file, set export options by creating an openScenarioExportOptions
object to enable export of signals and objects from the file.
options = openScenarioExportOptions(OpenDriveOptions=openDriveExportOptions(OpenDriveVersion = 1.5,ExportSignals = true,ExportObjects = true));
Once the scenario opens successfully, call the exportScenario
function to export the scenario to ASAM OpenSCENARIO®. Pass rrApp
, the scenario filename of the scenario, the export format, and the export options as input arguments to the function.
filename = "FourWaySignal.xosc"; formatname = "OpenSCENARIO"; exportScenario(rrApp,filename,formatname,options);
Input Arguments
rrApp
— RoadRunner application
roadrunner
object
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.
filename
— File path to the exported file
character vector | string scalar
File path to the exported file, specified as a character vector or string scalar.
filename
is absolute or relative to the exported file. If you
specify a relative path, then the exported file is saved relative to the
Exports
folder of the current project. If any folders in the path
are missing, RoadRunner tries to create them. filename
can include the
extension for the exported file or have no extension. If it has no extension, then
RoadRunner appends the extension of the format specified by the
formatname
to the file name before exporting the scenario.
Example: While calling
exportScenario(rrApp,"FourWaySignal.xosc","OpenSCENARIO",options)
,
"FourWaySignal.xosc"
represents the file name of the exported file,
which is relative to the Exports
folder of the current
project.
Data Types: char
| string
formatname
— Export format name
character vector | string scalar
Export format name, specified as a character vector or string scalar. This argument specifies the export format name corresponding to a valid RoadRunner export format. Format name options are case-insensitive. RoadRunner only supports ASAM OpenSCENARIO format.
Example: While calling
exportScenario(rrApp,"FourWaySignal.xosc","OpenSCENARIO",options)
,
OpenSCENARIO
specifies that the file will be exported to
ASAM OpenSCENARIO format.
Data Types: char
| string
exportoptions
— Export options configuration
openScenarioExportOptions
object | openScenario2ExportOptions
object
Export options configuration, specified as one of the export options objects
compatible with the format name specified in the formatname
argument.
This argument specifies the options to use during export. The export options
configuration property supports these objects:
openScenarioExportOptions
— Specify options for customizing files exported to the ASAM OpenSCENARIO 1.x format.openScenario2ExportOptions
— Specify options for customizing files exported to the ASAM OpenSCENARIO 2.0 format.
As of R2024a, if you specify exportoptions
as an
openScenarioExportOptions
object, the
SceneGraphOptions
property must be a sceneGraphExportOptions
object.
Version History
Introduced in R2022a
See Also
roadrunner
| openScenarioExportOptions
| openScenario2ExportOptions
| sceneGraphExportOptions
| importScenario
| openScenario
| close
Topics
- RoadRunner Scenario Fundamentals (RoadRunner Scenario)
- Simulate a RoadRunner Scenario Using MATLAB Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)