Main Content

openScenario

Open scenario in RoadRunner Scenario using MATLAB

    Description

    example

    openScenario(rrApp,filename) opens the specified scenario in the RoadRunner scene in which it was previously saved. If no current scene is specified in the project, MATLAB® returns an error.

    openScenario(rrApp,filename,keepCurrentScene) specifies whether to open the specified scenario in the scene it was previously saved with or in the current scene, regardless of which scene it was previously saved with.

    Examples

    collapse all

    Open a scenario in RoadRunner Scenario using MATLAB.

    Start RoadRunner and open the project called "C:\RR\MyProject".Return the RoadRunner application object in rrApp. This example assumes that RoadRunner is installed in its default location in Windows. 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 an existing scenario in RoadRunner Scenario by calling the openScenario function and passing it the rrApp object and the specific scenario filename that you want to open. This call opens the desired scenario in the RoadRunner Scenario application through MATLAB.

    filename = "MyScenario.rrscenario";
    openScenario(rrApp,filename);

    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.

    RoadRunner scenario file name, specified as a character vector or string scalar. If you specify this argument as a relative path, then the path is relative to the Scenarios folder of the current project. filename must end with either the .rrscenario extension or have no extension. If it has no extension, then RoadRunner appends the .rrscenario extension to filename before opening the scenario.

    Example: openScenario(rrApp,"MyScenario.rrscenario") opens MyScenario.rrscenario from the Scenarios folder of the current project.

    Data Types: char | string

    Open scenario in current scene, specified as a numeric or logical 0 (false) or 1 (true). If you set keepCurrentScene to true and there is no current scene, then MATLAB returns an error. If you set keepCurrentScene to false, then RoadRunner opens the scene that the scenario was previously saved with and opens the scenario into that scene.

    Data Types: logical

    Version History

    Introduced in R2022a