[value,rrVar] = getScenarioVariable(rrApp,name)
returns a structure, rrVar, for the variable in the current scenario with
the specified name. The structure rrVar consists of the name, string
value, and typed value of the variable. The TypedValue field is empty for
unsupported variable types.
Get a scenario variable 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
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.
Get the value of a scenario variable. Call the getScenarioVariable function and pass it the rrApp object and the variable whose value you want to retrieve. For example, this call retrieves a value of 17.88 as the initial speed of the Ambulance in the scenario, MyScenario. This example has an existing variable, Ambulance_InitialSpeed.
name = "Ambulance_InitialSpeed";
value = getScenarioVariable(rrApp,name);
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.
Name of variable to retrieve value, specified as a character vector or string
scalar. If the specified variable does not exist in the scenario, it results in an
error. For more details on creating variables in a scenario, see Generate Scenario Variations.
Example: getScenarioVariable(rrApp,"Ambulance_InitialSpeed);
retrieves the initial speed of the Ambulance vehicle.
Value assigned to variable, returned as a character vector or string scalar.
Example: getScenarioVariable(rrApp,"Ambulance_InitialSpeed")
retrieves the initial speed as 17.88 m/s assigned of the
Ambulance vehicle.
The variable values, returned as a structure 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.
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.