How To Reset Dragged Port Order

15 views (last 30 days)
RIchard
RIchard on 24 Aug 2023
Commented: Andrea Amorosi on 17 Jan 2024
Hi all and thanks in advance. With 2020a, one can drag a subsystem or reference model's ports around to make the lines easier to understand, without updating the child system's port numbers. It used to be that you would have to change the child's port number to get the parent model to show a new port order. I cannot find a good pic or video showing it but it is similar in style to this Matwork's video https://www.youtube.com/watch?v=gwq0Ufohkhc
I run a script that pulls the port info from the block but I have changed the port order by dragging it around. As such, I have broken the script as the order returned is the order the ports were created in the child model and not the order as they appear on the top level model. How do I reset the parent model's port ordering back to what the child's number shows?

Answers (1)

Animesh
Animesh on 31 Aug 2023
Hello @RIchard,
I understand that you want to reset the port order for a subsystem, but it is currently not possible to restore the subsystem its original state without a reference subsystem.
To remedy the lack of reference for the subsystem you can try following the below mentioned steps :-
  • Create a Custom Library for Simulink containing the Subsystem.
  • Copy the subsystem from the Custom Library to the required Simulink model.
  • Go to ‘Subsystem Block’ and under the ‘Library Link’ subsection and click on Disable Link.
  • When you want to reset the subsystem to its default state you can click on Restore Link and Simulink will make a fresh copy of the Subsystem taking the library subsystem as the reference.
To read more about Custom Libraries, please refer to the following documentation :- https://www.mathworks.com/help/simulink/ug/creating-block-libraries.html
  3 Comments
Andrea Amorosi
Andrea Amorosi on 17 Jan 2024
I'm facing the same issue.
Is it possible to disable this dragging feature so that the order of port is always defined by the port number of the called subsystem?
Andrea Amorosi
Andrea Amorosi on 17 Jan 2024
I've seen that exist the reset ports button inside the Format tab.
The button appears when a subsytem reference or a referenced model is selected and it is active if that instance has some dragged ports.
Is it possible to programmatically check if a selected instance of a model has dragged ports?

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!