File Exchange

image thumbnail

Delete unconnected lines

version (1.6 KB) by Per-Anders Ekstrom
Delete unconnected lines under a Simulink system


Updated 21 Sep 2006

View License

While "googling" the Matlab newsgroup I saw there were interest in being able to delete all unconnected lines inside a Simulink model. That is without actually doing it manually in the Simulink diagram.

Cite As

Per-Anders Ekstrom (2020). Delete unconnected lines (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)


works cleanly and as advertised. Put it as a project shortcut.

Fei Pan

Nice Thanks


Very useful code, but it doesn't work if the model parameters are not defined, though the parameters have nothing to do with the lines. but still this is not a problem at all, and the code works fine.

Christin Maier

Hi, I am trying to make a script, which deletes all contents of a simulink block diagram except its subfunctions, Ports and the lines between Subfunctions. Do you have any idea? (I know that's not the right place for the question but i am really in trouble)

Thierry Dalon

Very useful!
I've added this into my sl_customization.

Roberto Cantamessa

Malcolm Wood

Nice. Seems to deal with all the obvious edge-cases.

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