Resolve Failure to Convert Context Menu Customization to Extension Point Format
Issue
You can customize the Simulink® context menus that open when you right-click the model canvas or model
elements such as blocks, signal lines, and annotations. For information about how to
customize these menus, see Customize Simulink Context Menu Using Extension Points. If you
customized these context menus in a release before R2026a, to use the customizations
in R2026a and subsequent releases, you must convert the customizations to the
extension points format. You can convert the customizations using the slConvertCustomContextMenus function.
This page shows you how you can troubleshoot the process of converting the
customizations using the slConvertCustomContextMenus
function.
Possible Solutions
Work through the possible solutions in the listed order.
Verify Menu Tag Validity
Open the sl_customization.m file. Find the
cm.addCustomMenuFcn function. The first argument of the
function is the menu tag. The menu tag must be
Simulink:PreContextMenu or
Simulink:ContextMenu. The
Simulink:PreContextMenu menu tag indicates that you want
to add items to the top of the context menu. The
Simulink:ContextMenu menu tag indicates that you want to
add items to the bottom of the context menu.
Verify That All Schema Functions Specify Unique Tags
Open the sl_customization.m file. Find all schema
functions. You can find schema functions using the search term function
schema. Here is an example of a schema function.
function schema = getItem(callbackInfo) schema = sl_action_schema; schema.tag = "myTag"; schema.label = 'My Menu Item'; schema.callback = @myFunction; end
For each schema function, verify that one of the schema
properties specified in the function is the schema.tag
property. The schema tag is an identifier for the schema function, specified as
a string. For example, if you create a filter function to disable an action, in
the filter function, you specify which action to disable using a schema tag. The
slConvertCustomContextMenus function requires all
schema functions to have schema tags, for the schema tags to be nonempty, and
for the schema tags to be unique. If any schema function is missing a schema
tag, specify a schema tag for the function.
Verify Callback Function Format
Open the sl_customization.m file. Find all values of the
schema.callback property. Verify that all of these are
true:
The
schema.callbackvalue is a MATLAB® function handle, not a MATLAB script handle or a command.The function is defined in a separate file, and is not a local or nested function.
Verify That Files Required for Conversion Are on MATLAB Path
In order to do the conversion and view the results, these folders must be on the MATLAB path:
The parent folder of your
sl_customization.mfileThe parent folder of each MATLAB function referenced by the
sl_customization.mfileThe parent folder of the
extensions.jsonfile created by the conversion
To verify that these folders are on the MATLAB path, navigate into each folder. Then, right-click a blank space in the Files panel of the MATLAB Editor. If the context menu contains the option Remove from Path, the folder is on the path. If instead the context menu contains the option Add to Path, the folder is not on the path. To add the folder to the path, select Add to Path > Current Folder.
Verify That Customizations Are Refreshed
To view the customizations after conversion to the new format, you must
refresh the customizations. If you are unsure of whether you refreshed the
customizations, run the sl_refresh_customizations function to be sure.