Main Content

Simulink.sdi.markSignalForStreaming

Turn logging on or off for signal

Description

Simulink.sdi.markSignalForStreaming(block,portIndex,log) marks the signal on the specified portIndex of the specified block for logging when you specify log as 'on'. To stop logging a signal, specify log as 'off'.

Simulink.sdi.markSignalForStreaming(portHandle,log) marks the signal on the port specified by portHandle for logging when you specify log as 'on'. To stop logging a signal, specify log as 'off'.

example

Simulink.sdi.markSignalForStreaming(lineHandle,log) marks the signal with the specified lineHandle for logging when you specify log as 'on'. To stop logging a signal, specify log as 'off'.

example

Examples

collapse all

Load the model vdp.

mdl = "vdp";
load_system(mdl)

Use the get_param function to get the port handles for the blocks with your signals of interest.

x1_handles = get_param("vdp/x1","PortHandles");
x1 = x1_handles.Outport(1);
x2_handles = get_param("vdp/x2","PortHandles");
x2 = x2_handles.Outport(1);

Use the handles to mark the desired signals for logging.

Simulink.sdi.markSignalForStreaming(x1,"on");
Simulink.sdi.markSignalForStreaming(x2,"on");

Simulate the model.

sim(mdl);

Open the Simulation Data Inspector to view the logged signals.

Simulink.sdi.view

Load the model slexAircraftExample. and use get_param to get handles for the signals in the model. Then, use the line handles to mark signals of interest for logging.

load_system('slexAircraftExample')

Use the get_param function to get the line handles for the signals in the model.

lines = get_param('slexAircraftExample','Lines');

Use the Simulink.sdi.markSignalForStreaming function to mark two of the signals for logging using the line handles.

sig1handle = lines(1).Handle;
sig2handle = lines(2).Handle;

Simulink.sdi.markSignalForStreaming(sig1handle,'on')
Simulink.sdi.markSignalForStreaming(sig2handle,'on')

Simulate the model then open the Simulation Data Inspector to view the logged signal data.

out = sim('slexAircraftExample');

Simulink.sdi.view

Input Arguments

collapse all

Block path for the block with the desired signal connected to one of its outports.

Example: 'slexAircraftExample/Pilot'

Index of the port connected to the signal you want to mark for streaming.

Example: 1

Logging state desired for signal.

  • 'on' –– Turn logging on for a signal.

  • 'off' –– Turn logging off for a signal.

Port handle for the source block's output port that connects to the signal.

Example: x1_handles.Outport(1)

Line handle for the signal.

Example: lines(1).Handle

Version History

Introduced in R2015b