| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
About Disabling and Hiding Model Editor Menu Items Example: Disabling the New Model Command on the Simulink Editor's File Menu |
You can disable or hide items that appear on the Simulink model editor menus. To disable or hide a menu item, you must:
Create a filter function that disables or hides the menu item (see Creating a Filter Function).
Register the filter function with the customization manager (see Registering a Filter Function).
For more information on Model Editor menu items, see:
function sl_customization(cm)
cm.addCustomFilterFcn('Simulink:NewModel',@myFilter);
end
function state = myFilter(callbackInfo)
state = 'Disabled';
end
Your filter function must accept a callback info object and return a string that specifies the state that you want to assign to the menu item. Valid states are
'Hidden'
'Disabled'
'Enabled'
Your filter function may have to compete with other filter functions and with Simulink itself to assign a state to an item. Who succeeds depends on the strength of the state that each assigns to the item. 'Hidden' is the strongest state. If any filter function or Simulink assigns 'Hidden' to the item, it is hidden. 'Enabled' is the weakest state. For an item to be enabled, all filter functions and the Simulink or Stateflow products must assign 'Enabled'to the item. The 'Disabled' state is of middling strength. It overrides 'Enabled' but is itself overridden by 'Hidden'. For example, if any filter function or Simulink or Stateflow assigns 'Disabled' to a menu item and none assigns 'Hidden' to the item, the item is disabled.
Note The Simulink software does not allow you to filter some menu items, for example, the Exit MATLAB item on the Simulink File menu. An error message is displayed if you attempt to filter a menu item that you are not allowed to filter. |
Use the customization manager's addCustomFilterFcn method to register a filter function. The addCustomFilterFcn method takes two arguments: a tag that identifies the menu or menu item to be filtered (see Displaying Menu Tags) and a pointer to the filter function itself. For example, the following code registers a filter function for the New Model item on the Simulink File menu.
function sl_customization(cm)
cm.addCustomFilterFcn('Simulink:NewModel',@myFilter);
end
![]() | Adding Items to Model Editor Menus | Disabling and Hiding Dialog Box Controls | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |