Main Content

sltest.testsequence.getActiveScenario

Get Test Sequence block active scenario

Since R2020b

Description

example

active_scenario = sltest.testsequence.getActiveScenario(blockPath) returns the name of the active scenario for the Test Sequence block specified by blockPath. The active scenario is the scenario that runs during model simulation.

Examples

collapse all

Set the Test Sequence block in the sltestRollRefTestExample model to use scenarios. Add another scenario named new_Scenario and activate it. Then, get the name of the currently active scenario. You can use getActiveScenario only if you have set sltest.testsequence.setScenarioControlSource to sltest.testsequence.ScenarioControlSource.Block, which sets the active scenario control to a Test Sequence block instead of a variable in the workspace.

openExample('sltestRollRefTestExample');

sltest.testsequence.useScenario...
   ('sltestRollRefTestExample/Test Sequence',...
   'Scenario_1');
 
sltest.testsequence.addScenario...
   ('sltestRollRefTestExample/Test Sequence',...
   'new_Scenario');

sltest.testsequence.activateScenario...
   ('sltestRollRefTestExample/Test Sequence',...
   'new_Scenario');

active_scenario = sltest.testsequence.getActiveScenario...
   ('sltestRollRefTestExample/Test Sequence')
active_scenario =

    'new_Scenario'

Close the model without saving it.

close_system(Model,0)

Input Arguments

collapse all

Path to a Test Sequence block, including the block name, specified as a string or character vector. Instead of the block path, you can use a block handle.

Example: 'FanSpeedTestHarness/Test Sequence'

Output Arguments

collapse all

Active Test Sequence block scenario name, returned as a character vector.

Version History

Introduced in R2020b