Borrar filtros
Borrar filtros

Adjacency matrix Simulink model

6 visualizaciones (últimos 30 días)
Etienne
Etienne el 27 de Feb. de 2018
Editada: Sujit Muduli el 6 de Mzo. de 2018
Hi All
I was wondering if it is possible to build an adjacency matrix of a Simulink model? I am interested to build a matrix that shows the connection between components.
Regards
Etienne

Respuesta aceptada

Sujit Muduli
Sujit Muduli el 5 de Mzo. de 2018
Editada: Sujit Muduli el 6 de Mzo. de 2018
Hi Etienne,
It is possible to build an adjacency matrix of a Simulink model. But there are few things you need to take care of
  1. Simulink Models are not always flat rather they could be hierarchal if there are subsystems. I don't know if you have any particular model which is flat and you want to build adjacency matrix for that. If this is the case then it would be fairly straightforward. You could use find_system to get the list of the blocks and lines. Here lines are nothing but the edges of the graph. Now create the adjacency matrix and iterate over the list of line handles. For each line find the source and destination nodes. Then fill the adjacency matrix accordingly.
  2. But if you have a hierarchal model you have to serialize the model. Convert the model to be represented as a single graph, as the content of a subsystem could be seen as a separate graph itself.In order to do the serialization, you could call Simulink.BlockDiagram.expandSubsystem(block) to expand all the subsystems in the model. You could use find_system function to find the list of all the subsystems in the model.
Below are the links that you may refer to write the scripts for the same,
  1. https://in.mathworks.com/help/simulink/classeslist.html
  2. https://in.mathworks.com/help/simulink/functionlist.html

Más respuestas (1)

Etienne
Etienne el 5 de Mzo. de 2018
Thanks Sujit. This is very helpful. I will give it a try. I did manage to find all the subsystems using find_system, and then I could find the connections using the myTraceSignal function from the FEX.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by