Main Content

Target.Stimulation

Target computer model root inport stimulator object

Since R2021a

Description

A Target.Stimulation object represents the stimulation of root inports or Playback blocks of the model running on the target computer.

The object provides access to methods that:

  • Start and stop the root inport or Playback block stimulation.

  • Pause the root inport or Playback block stimulation.

  • Return the status of the root inport or Playback block stimulation.

  • Reload the data signal of the root inport or Playback block.

Creation

A Target.Stimulation object is created when you create a Target object by using the slrealtime command. After you create and connect the machine to the Target object, you can access the Target.Stimulation object. This example creates and connects to Target object tg, and then starts the stimulation of root inports or Playback blocks on the target computer.

Open the model slrt_ex_osc_inport and add an extra inport.

openExample('slrealtime/SlrtStimulateRootInportByUsingMATLABLanguageExample');
model = ('slrt_ex_osc_inport');
open_system(model);
load('slrt_ex_inport_square.mat');
waveform = square;
set_param(model,'ExternalInput','waveform');
set_param(model,'LoadExternalInput','on');
set_param(model,'StopTime','Inf');

Build the model. Load the real-time application. Start execution. Start stimulation.

slbuild(model);
tg = slrealtime('TargetPC1');
connect(tg);
load(tg,model);
start(tg,'StartStimulation','off');
start(tg.Stimulation,'all');

Object Functions

getStatusReturn status of root inports stimulation of model on target computer
pausePause stimulation of root inports of model on target computer
reloadDataReload data signal of root inports of model on target computer
startStart stimulation of root inports of model on target computer
stopStop stimulation of root inports of model on target computer

Examples

collapse all

In the model, start the stimulation of inports named In1 and In2.

start(tg.Stimulation,{'In1','In2'}); 
% if the port number of inport named 'In1' is 1
% and the port number of inport named 'In2' is 2
% this syntax is equivalent to:
%
% start(tg.Stimulation,[1,2]);

In the model, pause the stimulation of inports named In1 and In2.

pause(tg.Stimulation,{'In1','In2'});
% this syntax is equivalent to:
% pause(tg.Stimulation,[1,2]);

In the model, stop the stimulation of inports named In1 and In2.

stop(tg.Stimulation,{'In1','In2'}); 
% this syntax is equivalent to:
% stop(tg.Stimulation,[1,2]);

Version History

Introduced in R2021a