필터 지우기
필터 지우기

Renaming All Ports on a Connector Node - System Composer

조회 수: 5 (최근 30일)
Jared Gustafson
Jared Gustafson 2023년 10월 26일
편집: Josh Kahn 2023년 10월 27일
Is there a way in System Composer to rename a single port on a connector "node", and have every port (component port or architecture port) on that node be automatically renamed?

답변 (1개)

Josh Kahn
Josh Kahn 2023년 10월 27일
편집: Josh Kahn 2023년 10월 27일
Not through the GUI (only happens when all ports have default names) but you can do it programmatically. You could also create a custom edit-time check to flag it as a discrepancy (and offer a fix button) or a right-click context menu using sl_customizations.
To do it programmatically (Assuming you are using input/output ports. This would need to be adjusted for client/server or physical):
1. Lookup the starting port in the model (component output port)
2. Get connectors from the Connectors property of the port
3. Get destination ports (downstream input ports) from the DestinationPort property of the connector.
3. Set the name of the other ports
Here is the code:
archMdl = systemcomposer.loadModel('MyArchitecture')
port = lookup(archMdl, Path='MyArchitecture/path/to/component:MyPortName')
if port.Connected
connectedPorts = [port.Connectors.DestinationPort];
arrayfun(@(connectedPort) setName(connectedPort, port.Name), connectedPorts)
end
Custom edit time checks:
Extending the context menu:

카테고리

Help CenterFile Exchange에서 System Composer에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by