Add one port to a Simulink block, from command line AND automaticaly keep the same distance between ports
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
langrg
el 11 de Feb. de 2021
Respondida: Fangjun Jiang
el 11 de Feb. de 2021
Hi,
I'm trying to automate the creation of a Simulink model.
In some case I have to add sevral inport to BusCreators. The trouble is when I add an inport, using
get_param(buscreator_handle, 'Input', '15')
, while there were 13 inports before. The block keep the same size, but vertical distance between inports reduces...
Is there a quick way to automaticaly set block postion so that vertical distance between ports stay the same? Or does anyone know a simple computation to find 'Position' of block so that vertical distance between inports stay the same.
It's not just proportinal because I remember times ago I met BusCreator where first and last inports where exactly at top of and bottom of BusCreator, and sometimes not (gap between block top and first inport, and gap beetween last inport and block bottom).
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 11 de Feb. de 2021
I dealt with this problem before. There is no quick or automatic way but the following method worked for me to keep the existing signal lines straight.
You can get and set the position of the block, which in effect is to control the height of the block. Make
BlockHeight=a+b*n, where a is the offset, b is the linear scale, n is the number of ports you just set for the BusCreator block. You just need to play with a and b to keep the port distance the same. You might also need to play with the corner position of the block to keep the existing signal lines straight.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions 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!