Simulink - automatically hide the name of a new block?

58 ビュー (過去 30 日間)
Clayton Chu
Clayton Chu 2011 年 12 月 7 日
コメント済み: Robert 2023 年 7 月 3 日
Hi all -
When I build Simulink models I tend to immediately hide the name of a block unless it's not obvious exactly what it's doing (and then I rename it). For instance, I will hide the name of "Gain", "Sum", etc.
Is there a setting or way to automatically hide the name of a block I drop into a model? It gets tedious to do this manually, especially as there is no keyboard shortcut to do so.
Thanks!
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2011 年 12 月 7 日
How exactly do you hide the name? Do you delete the label? Or do you set it to blankspaces?

サインインしてコメントする。

採用された回答

Abhishek Gupte
Abhishek Gupte 2011 年 12 月 7 日
There is no way of automatically hiding the block names the moment you drop a block into a model. There is no setting in Simulink Preferences ( http://www.mathworks.com/help/releases/R2011b/toolbox/simulink/gui/briaid4.html ) to do this.
The workaround is:
1. Once you are done adding blocks to the model,
blockNames = find_system( bdroot , 'Type' , 'Block' );
for k = 1 : length( blockNames )
set_param( blockNames{k} , 'ShowName' , 'off' );
end;
2. If you run the above lines in the command window and then drag the lines from the Command History Window to the Shortcuts Toolbar, you can have a nice shortcut without having to type the lines each time.
3. I would recommend having a shortcut for:
set_param( blockNames{k} , 'ShowName' , 'on' );
as well.
  2 件のコメント
Jan
Jan 2023 年 2 月 17 日
Robert on 17 Jan 2023: Better answer is provided by Simon Greenwold below, following r2017b update.
Robert
Robert 2023 年 7 月 3 日
Maybe the link in Simon Greenwold's reply has broken, as I returned to this thread to remember how to hide block names and could not find the answer. To avoid future confusion, the answer in 17b onwards is to go to "Format" tab in simulink > "name" dropdown in BLOCK LAYOUT section > tickbox for "hide automatic block names".

サインインしてコメントする。

その他の回答 (3 件)

Simon Greenwold
Simon Greenwold 2017 年 11 月 14 日
We added a feature in R2017b to automatically hide block names when the names are default. It's documented here.
Does that help?
  1 件のコメント
Robert
Robert 2023 年 7 月 3 日
As link has changed, process in 17b onwards is: "Format" tab in simulink > "name" dropdown in BLOCK LAYOUT section > tickbox for "hide automatic block names".

サインインしてコメントする。


Abhijit Das
Abhijit Das 2012 年 3 月 30 日
Abhishek,
Thanks for the answer and it is helpful. Although it is working only with the main simulink window but not for munsked or subsystems. Are you aware of any tip for that too?
Thanks.
Abhijit
  1 件のコメント
Abhay khemka
Abhay khemka 2019 年 2 月 21 日
編集済み: Abhay khemka 2019 年 2 月 21 日
instead of this,
set_param( blockNames{k} , 'ShowName' , 'on' );
we can make it more generalised
set_param( pathTotheBlockName , 'ShowName' , 'on'/'off' ); this should work for all subsystems and blocks...
for masked systems, refer to the link below:
https://in.mathworks.com/help/simulink/ug/control-masks-programmatically.html
also, if you are working on a big system,make sure to name blocks or subsystems in a systematic order, so that u can access all the blocks/subsystems in one loop. That will reduce lot of effort.

サインインしてコメントする。


Robert
Robert 2018 年 11 月 30 日
If you have switched off "automatic" hide/display feature for all existing blocks, you can use
set(find_system(get_param(bdroot,'Handle'),'HideAutomaticName','on'),'HideAutomaticName','off','ShowName','off');
to hide the name of all newly added blocks of the current model.
If you need to switch off the "automatic name" in your models blocks i the first place, use
set(find_system(get_param('mymodelroot','Handle'),'HideAutomaticName','on'),'HideAutomaticName','off');
Generally switching off 'HideAutomaticName' is very useful when working with models that have to follow modelling rules such as MAAB or MISRA SLSF that do not allow spaces or line breaks that are found in most of the simulink default block names.
Best regs,
Robert

カテゴリ

Help Center および File ExchangeInteractive Model Editing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by