[Fix Inport position][Simulink Model]

1 visualización (últimos 30 días)
Binh Huynh Thanh
Binh Huynh Thanh el 9 de Jul. de 2020
Comentada: Binh Huynh Thanh el 11 de Jul. de 2020
Hello EveryOne,
I have a problem, please spend on your time to help me.
In matlab simulink, I would like to fix the Inport's position,
Even when I add or remove a Inport block, the previous others Inport's position are not changed.
Thank you in advance.

Respuestas (1)

Nikhil Kori
Nikhil Kori el 9 de Jul. de 2020
Editada: Nikhil Kori el 9 de Jul. de 2020
Hi,
To change the position of inport block you are supposed to use get_param and set_param.
block_size = get_param('model_name/block_name','Position');
X = block_size(1,1);
Y = block_size(1,2);
X + Width = size_blk(1,3);
Y + Height = size_blk(1,4);
set_param('model_name/block_name','Position',[X Y X+Width Y+Height]);
for example :-
set_param('vdp/Fcn','Position',[50 100 110 120])
You can refer to this link for more information set_param.
  1 comentario
Binh Huynh Thanh
Binh Huynh Thanh el 11 de Jul. de 2020
Thank you Nikhil Kori,
But when we remove a inport block in the simulink model then, others inport's position are automatically changed, right ? I would like to keep that position number without set_param again.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by