Yes, you can get the properties of the block connected outside the subsystem to a specific Outport block using MATLAB commands (via get_param and related functions).
Recommended Approach (Using the Subsystem Block)
This is often the easiest, especially if the Outport is directly connected outside without branching.
-
Get the line handles from the subsystem block (replace 'myModel/mySubsystem' with your subsystem path):
matlablineHandles = get_param('myModel/mySubsystem', 'LineHandles'); -
Get the destination block handles from the Outport lines:
matlabdstHandles = get_param(lineHandles.Outport, 'DstBlockHandle'); -
Convert to full block paths (handles are in a cell array if multiple Outports):
matlaboutsideBlockPaths = getfullname(dstHandles);- If there's only one Outport and one direct connection, outsideBlockPaths will be a string (e.g., 'myModel/SomeBlock').
- If branched (one Outport line splits to multiple blocks), it will be a cell array of paths.
-
Get any property of the outside block(s), e.g., block type:
matlabblockType = get_param(outsideBlockPaths{1}, 'BlockType'); % For the first oneOr all parameters:
matlabparams = get_param(outsideBlockPaths{1}, 'ObjectParameters');
Alternative Approach (Starting from the Outport Block Inside the Subsystem)
If you know the specific Outport block path (e.g., 'myModel/mySubsystem/Out1'):
- Get port handles:
matlab
portHandles = get_param('myModel/mySubsystem/Out1', 'PortHandles'); - Get the line handle from the Outport:
matlab
lineHandle = get_param(portHandles.Outport(1), 'Line'); % Usually one Outport - Get destination block handle(s):
matlab
dstHandles = get_param(lineHandle, 'DstBlockHandle'); - Then proceed as above with getfullname(dstHandles) and get_param.
This works even if the line branches outside the subsystem.
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Explore similar technical troubleshooting questions and verified MATLAB solutions: