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

5 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Robert U
Robert U am 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

Weitere Antworten (0)

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by