Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Disabling and Hiding Model Editor Menu Items

About Disabling and Hiding Model Editor Menu Items

You can disable or hide items that appear on the Simulink model editor menus. To disable or hide a menu item, you must:

For more information on Model Editor menu items, see:

Example: Disabling the New Model Command on the Simulink Editor's File Menu

function sl_customization(cm)
  cm.addCustomFilterFcn('Simulink:NewModel',@myFilter);
end

function state = myFilter(callbackInfo)
  state = 'Disabled';
end

Creating a Filter Function

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

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.

Registering a Filter Function

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

  


Related Products & Applications

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