Turn logging on or off for a signal
This example shows how to mark signals for logging using port handles.
Load Model and Mark Signals for Streaming
get_param to get the port handles for the blocks with your signals of interest. Then, use the handle to mark the desired signals for logging.
load_system('vdp') % Get port handles x1_handles = get_param('vdp/x1','PortHandles'); x1 = x1_handles.Outport(1); x2_handles = get_param('vdp/x2','PortHandles'); x2 = x2_handles.Outport(1); % Mark signals for streaming Simulink.sdi.markSignalForStreaming(x1,'on'); Simulink.sdi.markSignalForStreaming(x2,'on');
Simulate Model and View Signals in the Simulation Data Inspector
Simulate the model and then open the Simulation Data Inspector to view the logged signals.
This example shows how to mark signals for logging using their line handles.
Load System and Mark Signals for Logging
Load a model 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') lines = get_param('slexAircraftExample','Lines'); sig1handle = lines(1).Handle; sig2handle = lines(2).Handle; Simulink.sdi.markSignalForStreaming(sig1handle,'on') Simulink.sdi.markSignalForStreaming(sig2handle,'on')
Simulate Model and View Signals
Simulate the model and view the signals marked for logging in the Simulation Data Inspector.
block— Source block path or handle
Block path for the block with the desired signal connected to one of its outports.
portIndex— Source block output port index
Index of the port connected to the signal you want to mark for streaming.
log— Logging state
Logging state desired for signal.
'on' –– Turn logging on for a
'off' –– Turn logging off for a
portHandle— Source block output port handle
Port handle for the source block's output port that connects to the signal.
lineHandle— Signal line handle
Line handle for the signal.