How To Reset Dragged Port Order

3 次查看(过去 30 天)
RIchard
RIchard 2023-8-24
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?

回答(1 个)

Animesh
Animesh 2023-8-31
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 个评论
Andrea Amorosi
Andrea Amorosi 2024-1-17
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 2024-1-17
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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Component-Based Modeling 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by