slConvertCustomContextMenus
Convert Simulink context menu customizations to extension points format
Since R2026a
Syntax
Description
slConvertCustomContextMenus(SourceFolder=
converts the file defining your Simulink® context menu customizations to the extension points format. Starting in
R2026a, Simulink context menu customizations must be defined using extension points.source)
The slConvertCustomContextMenus function reads the
sl_customization.m file in the specified source folder and generates a
resources folder containing an extensions.json file
in the destination folder. By default, the destination folder is the current folder. If an
extensions.json file already exists in that location, this syntax does
not overwrite the file.
To run the function, your customization must meet the requirements listed in Limitations and must be enabled. To enable the customization:
Add the parent folder of the
sl_customization.mfile to the MATLAB® path using theaddpathfunction or by right-clicking the folder in the Files panel and selecting Add to Path > Selected Folder(s) and Subfolders.Refresh the customization using the
sl_refresh_customizationsfunction.
Once the conversion is complete, enable the customizations defined in the
extensions.json file:
Add the parent folder of the
resourcesfolder to the MATLAB path using theaddpathfunction or by right-clicking the folder in the Files panel and selecting Add to Path > Selected Folder(s) and Subfolders.Reload the Simulink studio configuration using the
slReloadStudioConfigfunction.
Differences between the limitations of the extension points format and the previous
format can result in the converted customization behaving differently from the original
customization. Check the generated extensions.json file and the resulting
context menu in the software. To learn about the extension points format so that you can
check and edit the extensions.json file, see Customize Simulink Context Menu Using Extension Points.
To troubleshoot the conversion, see Resolve Failure to Convert Context Menu Customization to Extension Point Format.
slConvertCustomContextMenus(SourceFolder=
takes the same action but if the source,Replace,true)resources folder in the destination
folder already contains an extensions.json file, this syntax overwrites
the file.
Examples
Input Arguments
Name-Value Arguments
Limitations
To run the function, all of these conditions must be true of the
sl_customization.m file.
The menu tag must be
Simulink:PreContextMenuorSimulink:ContextMenu.All schemas must specify tags, and the tags must be nonempty and unique.
All
callbackproperty values must be handles of MATLAB functions.None of the
callbackproperty values can be handles of MATLAB scripts.None of the
callbackproperty values can be commands. For example, thiscallbackproperty value is invalid:action.callback = "disp("Hello World!")"
None of the callbacks can be nested or local functions.
The source folder must be on the MATLAB path.
The slConvertCustomContextMenus function does not convert keyboard
shortcuts for triggering custom actions.
Version History
Introduced in R2026a
