Clear Filters
Clear Filters

How do I disable Simulink Toolstrip Actions in MATLAB R2023b?

10 views (last 30 days)
I'm building a GUI for a tool that allows a user to build Simulink system models. I'm creating a Simulink model template to have consistent models built by the user. I'm trying to disable actions in the Simulink toolstrip to avoid the user working outside the GUI. I'm using the article:
as a guide on how to do this but I'm having difficulty getting this to work. I'm confused because in this article, it says "To get the name and icon for a built-in action from the Simulink Toolstrip, use the 'slToolstripDeveloperMode' function." Following the example shown in the article, when I pause and click CTRL over the new model icon, I get:
Action: createNewModelAction
Icon: model
But the example in the article uses the syntax:
function sl_customization(cm)
cm.addCustomFilterFcn('Simulink:NewModel',@myFilter);
end
function state = myFilter(callbackInfo)
state = 'Disabled';
end
This syntax works to Disable the new model button. My question is, why is the syntax 'Simulink:NewModel' and not 'Simulink:createNewModelAction'? What am I missing and how do I find the correct syntax to use for the other actions in the toolstrip?

Accepted Answer

Deep
Deep on 26 Oct 2023
Edited: MathWorks Support Team on 26 Oct 2023
The action names that show up in the MATLAB Command Window after you hover over an icon and press CTRL should be used as-is. Note, to turn on this feature, run
>> slToolstripDeveloperMode('on')
In the question proposed, "createNewModelAction" should be passed to the method "addCustomFilterFcn". For example, the following code placed in "sl_customization.m" disables the "Model" icon. 
function sl_customization(cm)
cm.addCustomFilterFcn('createNewModelAction',@myFilter);
end
function state = myFilter(callbackInfo)
state = 'Disabled';
end
Note that while "Simulink:NewModel" works as per the documentation example, this tag name does not follow the action names written in the documentation. The inconsistency in our documentation has been relayed to our development team to consider updating in future releases.

More Answers (0)

Categories

Find more on Simulink Environment Customization in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!