File Exchange

image thumbnail

Simulink I/O Align Tool

version (5.66 KB) by Mohamed El-Attal
A GUI to align input and output ports to their connected subsystems


Updated 28 Aug 2007

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 (6)

Very Useful. I have added the option to align From and GoTo Blocks also:

Hi, very useful code. I made a little improvement so that you can have it with a right click button here :

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'))
%taken from sliotool.m

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.


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

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor