MATLAB: Simulink – automatically hide the name of a new block

gui simulink blocksimulink

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!

Best Answer

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.