Turn streaming on or off for a signal
% 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
% 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);
block— Source block path or handle
Block path or handle that contains the signal source, specified as a character vector.
port_index— Source block output port index
Source block output index of the associated signal, specified as an integer.
state— Streaming state toggle
Turn streaming for a signal on or off, specified as a logical value.
port_handle— Output port handle
Source block output port of the associated signal, specified as a handle.
line_handle— Signal line handle
Source block signal line, specified as a handle.