Azzera filtri
Azzera filtri

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

6 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Robert U
Robert U il 10 Ago 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

Più risposte (0)

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by