How to move the position of a block name to the top through matlab command?

3 views (last 30 days)
I am trying to move the block name of a certain block to the top of the block instead of the bottom. I know it's pretty easy to do if you have the model open (just drag it to the top), but is there a command which can be used to do this?

Accepted Answer

Robert U
Robert U on 10 Aug 2018
Hello Suzuki Kota,
There indeed is a command to perform that name plate alternation:
% Name plate bottom
set_param(blockHandle,'NamePlacement','normal');
% Name plate top
set_param(blockHandle,'NamePlacement','alternate');
Example model:
sysH = new_system('myNewSystem');
open_system(sysH);
bH1 = add_block('simulink/Sources/Constant','myNewSystem/Constant','Position',[50,50,80,80]);
bH2 = add_block('simulink/Sinks/Terminator','myNewSystem/Terminator','Position',[150,50,180,80]);
bH1PortHandles = get_param(bH1,'PortHandles');
bH2PortHandles = get_param(bH2,'PortHandles');
lH1 = add_line(sysH,bH1PortHandles.Outport(1),bH2PortHandles.Inport(1));
% place name plate above 'Terminator'
set_param(bH2,'NamePlacement','alternate');
Kind regards,
Robert

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!