Changing the size and position of the simulink block

214 views (last 30 days)
How can I change the position and size of the simulink block from the matlab command window?
sys = 'testmodel';
add_block('Simulink/Commonly Used Blocks/Subsystem',[sys '/subsystem])
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

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 22 May 2015
set_param('Model_Name/Block_Name','Position',[50 50 200 100])
Nabil akroud | نبيــل عكرود
Nabil akroud | نبيــل عكرود on 16 Nov 2021 at 16:02
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:

Sign in to comment.

More Answers (1)

Prerana Ozarkar
Prerana Ozarkar on 5 Mar 2019
Edited: Prerana Ozarkar on 5 Mar 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]

Community Treasure Hunt

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

Start Hunting!