Arranging a simulink models inport and outport using a function m-file.
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi , when we build a simulink model it contains many subsystems and its inports and outports will be connected to other blocks randomly arranged(i.e not in line with the ports) .Can you help me writing function so that when i select the subsytem and run the function all the blocks connected to the respective ports are in straight line. and if a inport or outport is not connected to any block connect it to input block or output block respectively...
0 comentarios
Respuestas (1)
Fangjun Jiang
el 12 de Sept. de 2011
I have that function but can't share because it's work related. You could develop your own.
By default, all signal lines are in straight line (vertical or horizontal, not diagonal) unless you are using really old versions of Simulink.
You could write a function to check the connectivity of the Subsystem block using get_param(SubSystemBlock,'PortConnectivity') and then connect ports with the ports of other subsystem block. How to connect depends on what you want because you could match the port block name, or you could match port signal name, or something else. The command to draw the line is add_line(). If you want diagonal line, set the 'autorouting' option to be 'off'.
2 comentarios
Fangjun Jiang
el 12 de Sept. de 2011
It's not trivial but could be done. My function does the connection by matching port block name.
Ver también
Categorías
Más información sobre Subsystems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!