Well, I answered my own question...PortConnectivity is the parameter I was looking for. Here is some code that will "clean up" the input and output ports for a subsystem like that above (assuming input and output port blocks are connected to the subsystem block). Make sure you select the subsystem to clean-up first!
pc = get_param(gcb,'PortConnectivity');
offset = 200;
for i = 1:numel(pc)
y = pc(i).Position(2);
x = pc(i).Position(1);
if isempty(pc(i).SrcBlock)
ph = pc(i).DstBlock;
off = -(offset-50);
else
ph = pc(i).SrcBlock;
off = offset;
end
pp = get_param(ph,'Position');
w = pp(3)-pp(1);
h = pp(4)-pp(2);
set_param(ph,'Position',[x-off,y-h/2,x-off+w,y+h-h/2]);
end
Best Answer