removeObserver
Description
removeObserver(
removes the observer named ScenarioSim
,ObserverName
)ObserverName
from the
Simulink.ScenarioSimulation
object
ScenarioSim
.
Examples
Remove Observer from Scenario Simulation
Create ScenarioSim
, a Simulink.ScenarioSimulation
object.
rrApp = roadrunner('C:\RoadRunnerProject'); openScenario(rrApp,'TrajectoryCutIn'); ScenarioSim = createSimulation(rrApp);
Create the class mySysObserver
, which inherits from
matlab.System
base class. The mySysObserver
class
represents an observer.
classdef mysysObserver < matlab.System properties(Access=private) % … end methods % constructor for the System object function obj = mysysObserver() end end methods(Access = protected) %reset the values function resetImpl(obj) obj.mScenarioSimObj = Simulink.ScenarioSimulation.find('ScenarioSimulation', 'SystemObject', obj); obj.mScenarioSimActorList = []; obj.mIsPacingTurnedOff = false; end % get the required parameter values function stepImpl(obj) mSimulationPace = obj.mScenarioSimObj.get('SimulationPace'); mScenarioSimActorList = obj.mScenarioSimObj.get('ActorSimulation'); end end end
Add the observer to the scenario.
obsStatus = addObserver(ScenarioSim,'ReadPaceandActors',mysysObserver);
Remove the observer from the scenario.
removeObserver(ScenarioSim,'ReadPaceandActors');
Input Arguments
Version History
Introduced in R2022a