Documentation

Simulink.sdi.markSignalForStreaming

Turn streaming on or off for a signal

Syntax

Simulink.sdi.markSignalForStreaming(block,port_index,state)
Simulink.sdi.markSignalForStreaming(port_handle,state)
Simulink.sdi.markSignalForStreaming(line_handle,state)

Description

example

Simulink.sdi.markSignalForStreaming(block,port_index,state) turns streaming on or off for a signal by specifying the block, block, and port index, port_index.

example

Simulink.sdi.markSignalForStreaming(port_handle,state) turns streaming on or off for a signal by specifying the block output port, port_handle.

example

Simulink.sdi.markSignalForStreaming(line_handle,state) turns streaming on or off for a signal by specifying the signal line handle, line_handle.

Examples

collapse all

% Open the model
sldemo_absbrake;

% Turn on streaming for the Weight block signal outport 
% in sldemo_absbrake model
Simulink.sdi.markSignalForStreaming('sldemo_absbrake/Weight',1,'on');

Open a model, and select a block with a signal outport to stream.

% Get the selected block port handles
phs = get_param(gcb,'PortHandles')

% Turn streaming on for the block outport
Simulink.sdi.markSignalForStreaming(phs.Outport(1),'on');

Open a model, and select a signal marked for streaming.

% Get the signal line handles for the model
slhs = get_param(gcs,'Lines');

% Turn streaming off for the first signal in the structure
Simulink.sdi.markSignalForStreaming(slhs(1).Handle,'off');

You can save the set of streamed signals to a file and then restore them to your model at a later time using the Simulink.HMI.InstrumentedSignals class.

% Save signals that are currently streamed in a model
sigs = get_param(bdroot,'InstrumentedSignals');
save my_instrumented_signals.mat sigs

% Remove all streamed signals from the model
set_param(bdroot,'InstrumentedSignals',[]);

% Restore streamed signals to the model
load my_instrumented_signals.mat
set_param(bdroot,'InstrumentedSignals',sigs);

Input Arguments

collapse all

Block path or handle that contains the signal source, specified as a character vector.

Example: 'sf_car/shift_logic'

Source block output index of the associated signal, specified as an integer.

Example: 1

Turn streaming for a signal on or off, specified as a logical value.

Example: 'on'

Source block output port of the associated signal, specified as a handle.

Example: phs.Outport(1)

Source block signal line, specified as a handle.

Example: sls(1).Handle

Introduced in R2015b

Was this topic helpful?