File Exchange

image thumbnail

Show Block Name Toggle & Shortcut Key

version 2.0.0 (3.08 KB) by Mike Anthony
Adds a menu item and keyboard shortcut Ctrl+Shift+F to show/hide a block name.


Updated 22 Jul 2020

View Version History

View License

New Version!

Ever wish you could show or hide the name of the block without having to navigate to right-click->Format->Show Block Name?
This adds a custom menu item in the right-click Menu to toggle the state of the 'ShowName' and 'HideAutomaticName' properties of one or more selected blocks in your model.
More important, this assigns this function to the keyboard shortcut Ctrl+Shift+F. So now you just highlight the blocks and hit Ctrl+Shift+F to toggle the Show Block Name option!

The latest version fixes a few issues:

1. Auto show/hide name
In R2017b, the option to show a block's name had a 3rd option added: "Auto." This option automatically hides blocks with default block names (e.g. Gain1, In1, etc). The implementation of this created a new block property, HideAutomaticName, which needs to be considered in this shortcut. This function has been updated to toggle through the 3 options in this order:
- Auto
- On
- Off
Note: If you select multiple blocks, it will toggle each of them independently. For example, if block1 is currently Auto, and block2 is currently On, after toggling with the shortcut key block1 will be On and block2 will be Off.

2. Shortcut Key
Per the R2020a documentation, Ctrl+Shift+S has been assigned to a built-in function, save active referenced model ( It's rarely a good idea to try to override built-in shortcuts, so the safer approach is to alter the shortcut key for this function. I have changed the shortcut to: Ctrl+Shift+F. Why did I choose this? Because I want to easily be able to trigger this shortcut with my left hand only, keeping my right hand on the mouse. If you prefer a different shortcut key, simply edit line 46 of the sl_customization file. Just be careful and be sure to check for conflicting assignments in Preferences->Keyboard->Shortcuts

Cite As

Mike Anthony (2020). Show Block Name Toggle & Shortcut Key (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)

Mike Anthony

Thanks for the comments everyone! I just posted an updated version for R2017b and later based on your feedback. Enjoy and let me know if you have any further issues.

Hi all, I have MATLAB R2020a and this shortcut is assigned to "save as". Can someone tell me how to change this to "show and hide block names"?

Victor Daldegan

This is great. Initially it wasn't working for me, but I found it was because my MATLAB R2020a already had something assigned to Ctrl+Shift+S by default. Thank you!

Mohammad Sleiman

WANG Jason

Great work. It really save time when dealing with a large model.


Dan Willans

Mike Anthony

Hi Everyone. Sorry for the delay on this, but I just uploaded a fix for the subsystem name issue a few of you have discovered.

As DoBe found, the issue was with the command:
blks = find_system(gcs,'Selected','on');

In this case, gcs is used to let me search the current subsystem. However, find_system(gcs,'Selected','on') also returns gcs itself, which is why the name of the parent subsystem was getting toggled.

The included update filters out the parent subsystem from the list of selected blocks to prevent this issue.

I've also verified that this works up to Release R2016b. The initial use of the shortcut still exhibits a significant lag, but the performance should be much faster after that.

Thanks for all the comments!


The Problem, that the script does not work in subsystems is also apparent in my matlab, I solved this by changing the find_system command parameter gcs to gcb

function ShowNameCallback(callbackInfo)
blks = find_system(gcb,'Selected','on');
for i = 1:length(blks)
sn = get_param(blks{i},'ShowName');
if strcmp(sn,'on')


Hi Mike,

Thank you for this script, but it seems not to work in R2016a (trial version).

Hong Xiao

Hello Mike,
thank you very much, that's really very helpful! :)
But I have found maybe a small issue, if I go to a subsystem with double click first and hide a block name in this subsystem with the shortcut, it seems the name of this subsystem is also hiden.. It looks like the Subsystem is also treated as selected.
Maybe it is also possible to keep the influence of the shortcut only in the working model layer?

Best regards

Brian Holm-Hansen

If this awesome trick was included with Simulink by default, it would probably save the aerospace industry billions! Thanks for submitting this Mike!

Sebastián Carrazzoni

Thank you very much! The customization works perfectly now. Very simple instructions to follow after all. I wonder why I couldn't find these steps elsewhere. I hope my question and your answer can help other people having difficulties in adding customizations to Simulink. Thanks again!

Mike Anthony

Hi Sebastian,

I apologize if the use of sl_customization.m is confusing. I think the issue you're running into is not specific to sl_customization.m, but instead is related to your need to customize your MATLAB search path. The MATLAB search path defines all of the directories where MATLAB can look for files. By default, your root MATLAB directory and all subfolders are included in your MATLAB path. However, you can include any other folders you want on your path as well.

Our recommended practice is that you DO NOT save your own work in or under the root MATLAB folder. The exception to this is if you want to create a work folder, e.g.


However, I would instead recommend saving the sl_customization.m file somewhere else, like


Then, open MATLAB, and add the folder where you saved sl_customization.m to your MATLAB path, either through the Set Path dialog box (Home Tab, Environment section, Set Path) or by typing at the MATLAB command prompt:


Then, at the MATLAB command prompt, type:


If you open a Simulink model, the customization should have worked. To verify, in a Simulink model look for an item "Show/Hide Block Name" in the Diagram menu.

Note that if you use the addpath() command, any alterations to the search path are not automatically saved from one MATLAB session to the next. If you wish that path change to persist between sessions, use the function savepath() (or the save button in the Set Path dialog box).

The directories I used above are not specific. In general, you can save your work anywhere on your machine (except in the root MATLAB directory), and then add your directories to your MATLAB path so that MATLAB can see the folders where you saved your work.

I hope this makes sense. If not, please refer to the documentation on the MATLAB Path for further explanation.

Please also feel free to contact our technical support (508-647-7000) or

They will be able to further assist you with this problem.


Somehow I forgot to mention my problem explicitly. I can't get the customization to work. I press CTRL+Shift+S and nothing happens even after resetting MATLAB. I hope you can help me with all the info I've provided. Thank you again.


Thanks for your quick reply it works smoothly.


How do you add this to SIMULINK ?

should I run the sl_customization function?

But with which argument?

Thanks for your time.

MATLAB Release Compatibility
Created with R2020a
Compatible with R2017b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!