Hi 珊,
The following commands can be used to automate the processing of logging a signal without using the "Multimeter" block:
% open the Simulink model (using the example model "power_compensated" here)
open_system('power_compensated');
% Add a 'To Workspace' block to the Simulink model
toWorkspaceBlock = add_block('simulink/Sinks/To Workspace', 'power_compensated/To Workspace');
% Set the variable name for the signal to be logged and its save format
set_param(toWorkspaceBlock, 'VariableName', 'logged_signal');
set_param(toWorkspaceBlock, 'SaveFormat', 'Array');
% Connect the block with its port number to "To Workspace" block for the
% signal you want to log (Demux port number 1 signal in this case)
add_line('power_compensated', 'Demux/1', 'To Workspace/1');
% Run the simulation and the logged signal will be saved to the workspace
sim('power_compensated');
Refer here for more information on the "power_compensated" example model and “To Workspace” block:
- https://www.mathworks.com/help/sps/powersys/ref/multimeter.html#:~:text=The%20power_compensated%20example%20uses%20a%20Multimeter%20block%20to%20measure%20the%20voltage%20across%20the%20secondary%20winding%20of%20a%20Saturable%20Transformer%20block%20and%20the%20currents%20flowing%20through%20two%20Series%20RLC%20Load%20blocks.
- https://www.mathworks.com/help/simulink/slref/toworkspace.html