How to connect ports with system composer using the dot notation for buses programmatically?
7 views (last 30 days)
Show older comments
Hi! I would like to connect ports like in the picture below, using the bus dot notation.
Note that message1 and message2 are signals within a bus.
I am able to do it by hand, how to do it programmatically?
Thanks!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1512549/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1512554/image.png)
0 Comments
Answers (1)
Josh Kahn
on 17 Oct 2023
Use the SourceElement and DestinationElement arguments of the connect API:
Regards,
Josh
6 Comments
Andrea
on 8 Mar 2024
Hi Josh, I have a further question regarding these architecture ports and dot notation for buses. I have a simple architecture, and I want to create an Input/Output excel file automatically through a Matlab script.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1638236/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1638241/image.png)
My problem is that I cannot find a way to get which PDU inside the CAN1 bus is connected to which PDU in CAN2. This is, I cannot get the connections I made inside the MappingBlock. Through Matlab commands I am able to get all the ports and all the components, and inside I can see the connections between CAN1 and the CAN2 PDUs, but not the specific CAN1 PDUs that are linked to the ones in CAN2. Also I am able to see which CAN1 PDUs are selected, however not to which CAN2 PDUs they are connected. Could you help me with this?
modelName = "Arch";
model = systemcomposer.openModel(modelName);
arch = get(model, modelName);
load_system(modelName);
open_system(modelName);
MappingBlock = arch.Components(1,3);
Josh Kahn
on 20 Mar 2024
Hi Andrea,
Let me know if these get you what you need:
Josh
See Also
Categories
Find more on System Composer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!