Borrar filtros
Borrar filtros

Changing the size and position of the simulink block

255 visualizaciones (últimos 30 días)
How can I change the position and size of the simulink block from the matlab command window?
sys = 'testmodel';
new_system(sys);
load_system(sys);
add_block('Simulink/Commonly Used Blocks/Subsystem',[sys '/subsystem])
add_block('builtin/Outport','testmodel/ouput1','MakeNameUnique','on')
now i have created one subsystem and one outport.
what are the commands i need to use for changing the model size and position of the block?
Thanks a lot

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 22 de Mayo de 2015
set_param('Model_Name/Block_Name','Position',[50 50 200 100])
  5 comentarios
Nabil akroud | نبيــل عكرود
Editada: Nabil akroud | نبيــل عكرود el 18 de Nov. de 2021
by using get_param
  • get_param(Object,Parameter)
for example, the following code will open the vdp example and will give you the position of the gain block (Mu) inside it:
open_system('vdp')
get_param('vdp/Mu','position')
Abdelghafar Elkhaoui
Abdelghafar Elkhaoui el 27 de Mzo. de 2022
@Slimeni Omar to get the position of any block in simulink model :
get_param('Model_Name/Block_Name','Position')

Iniciar sesión para comentar.

Más respuestas (1)

Prerana Ozarkar
Prerana Ozarkar el 5 de Mzo. de 2019
Editada: Prerana Ozarkar el 5 de Mzo. de 2019
You need to use following command:
get_param(pathOfsystem, 'Position')
this will retuen you a 1X4 matrix in which positions will be stored in a manner [X Y Width Height]

Categorías

Más información sobre Programmatic Model Editing 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!

Translated by