disable/enable custom menu sl_customization

조회 수: 6 (최근 30일)
langrg
langrg 2021년 2월 4일
답변: langrg 2021년 2월 5일
Hi,
Using sl_customization I've created a sub-menu of Tools menu in Simulink (cm.).
I've found and understood how to add a filter to an existing main menu in Simulink (using addCustomFilterFcn) so that I can manage the menu to be enabled/disabled.
How can I do the same with my own sub-menu?
Thanks!
GL

채택된 답변

langrg
langrg 2021년 2월 5일
I'v finaly found the solution by myself.
When you create the schema of your function for your menu, you have to define tag property:
%% Define the schema function for first menu item.
function schema = getItem1(callbackInfo)
schema = sl_action_schema;
schema.label = 'Item One';
schema.userdata = 'item one';
schema.tag = 'MyMenu:Item1'; % HERE
schema.callback = @myCallback1;
end
Then you can create a filter using the tag you gave:
cm.addCustomFilterFcn('MyMenu:Item1',@myFilter);
Finaly, you can create the function myFilter to manage the state enabled/disabled of your menu. As explain here:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by