File Exchange

image thumbnail

Simulink I/O Align Tool

version 1.0 (5.66 KB) by

A GUI to align input and output ports to their connected subsystems

11 Downloads

Updated

View License

This is a small tool to help in model editing in Simulink.

The tool allows to automatically align input and output ports connected to subsystems. The conditions are that the system port is not connected to other ports and the input/output port is not connected to other subsystems, i.e. a one-to-one relationship.

Aligning is applied only on selected subsystems / inports / outports. There are check boxes to assist in selection of current system's subsystems / inports / outports.

Aligning is applied on the current system, the blue area shows the result of gcs (get current system), it can be updated by a right click.

Comments and Ratings (5)

Hi, very useful code. I made a little improvement so that you can have it with a right click button here :
https://fr.mathworks.com/matlabcentral/fileexchange/67579-simulink-subsystem-i-o-alignment

Kent Schonert

Very useful tool.

I modified on my setup so I could align my selected IO + subsystem from the right click context menu (sl_customization.m) using this callback:

function AlignSelected(callbackInfo)
h_subsystems =find_system(gcs,'Findall','on','Selected','on','BlockType','SubSystem');
%Remove parent block from selection
h_subsystems = h_subsystems(find(h_subsystems~=get_param(gcs, 'Handle')));

for i = 1:length(h_subsystems)
if (strcmp(get_param(h_subsystems(i),'Selected'), 'off'))
continue;
end
%taken from sliotool.m
align_ports(h_subsystems(i));
end
end

Very useful tool, especially with complex systems.
Thanks a lot

Mohamed El-Attal

I can't know what is the problem in your case without further details.
Make sure the system name you want to apply aligning to its elements is shown in the blue area and that the elements (subsystems and ports) are selected before clicking align.

I hope this will make it work.

T T

Could not get it to work. Nothing happens when I click Align. Using R14sp2.

MATLAB Release
MATLAB 7.1.0 (R14SP3)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video