MATLAB Answers


Adding New Menu in SImulink

Asked by Sunu
on 9 Oct 2012
Latest activity Answered by Nick
on 18 Apr 2016

Is it possible to add new menu (like File, Edit) in Simulink



2 Answers

Answer by Nick
on 18 Apr 2016

Although this is an old question, I would like to point to this blog item, in which is explained how to organize your customizations in Simulink and/or Stateflow in a structured way.


Answer by Babak
on 9 Oct 2012

Yes it is possible.

Look up sl_customization(cm) on MATLAB's documentation.

You need to write a function whose name must be sl_customization(cm) and put it on MATLAB's path. then issue savepath in command window so that it will remain on the path if you restart MATLAB.

In the sl_customization(cm) function you can add new items to Simulink's menue items and tell Simulink what it should do when each of the custom menu items are clicked.

Generally it is in the customizing the Simulink environment in the Simulink documentation help.


on 9 Oct 2012

I want to add a new menu like (say Actions) and not add to existing menu item.

on 9 Oct 2012

This is still what does it for you:

 function sl_customization(cm)
  cm.addCustomMenuFcn('Simulink:MenuBar', @getYOURMENUitems);
 function schemaFcns = getYOURMENUitems(callbackInfo)
    schemaFcns = {@getYOURMENU_container};
 function schema = getYOURMENU_container(callbackInfo)
    schema = sl_container_schema;
    schema.tag = 'Simulink:yourname1';
    schema.label = 'yournameeee1';
    %schema.userdata = '';
    %     schema.childrenFcns={@getItem0, 'separator',    @getItem_comm_container, 'separator',  @getItem1, @getItem2, 'separator', @getItem_status_container, 'separator',  @getItem_build_download_container, 'separator', @getItem_task_manager};

you need to write all the getitems functions...

see the help

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!