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

3 次查看(过去 30 天)
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?

采纳的回答

Robert U
Robert U 2018-8-10
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by