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

3 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Robert U
Robert U el 10 de Ag. de 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

Más respuestas (0)

Categorías

Más información sobre Modeling 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