Main Content

getAllScenarioVariables

Get the values of all RoadRunner scenario variables using MATLAB

Since R2023b

    Description

    example

    values = getAllScenarioVariables(rrApp) gets the names and values of all variables in the current scenario of the specified RoadRunner instance.

    Examples

    collapse all

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This call assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

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

    Open an existing scenario in the specified project by using the openScenario function, specifying the rrApp object and the specific scenario filename that you want to open as inputs.

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

    Get the values of all variables from the scenario.

    values = getAllScenarioVariables(rrApp);

    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.

    Output Arguments

    collapse all

    Values of the scenario variables, returned as a structure array with these fields:

    • Name — Name of the variable.

    • Value — String value of the variable.

    • TypedValue — Value of the variable as displayed in RoadRunner, such as an integer or double. The TypedValue field is empty for unsupported variable types, such as an array.

    Example: If the scenario contains a variable called InitialHeading with a value of -90, getAllScenarioVariables(rrApp); gets all variable names and values in the scenario currently open in the rrApp instance of RoadRunner and returns a structure with a Name of 'UTV_InitialHeading', a Value of '-90' and a TypedValue of -90.

    Version History

    Introduced in R2023b