필터 지우기
필터 지우기

Creating callbacks to children in menus

조회 수: 2 (최근 30일)
Luis Pantin
Luis Pantin 2020년 7월 16일
Hello All,
I am trying to create the same callback for each of the children in a menu bar. When the function getfile is called, several children are populated to the "Open User Setting menu bar". Now, when I run the app and click one of the children menus, I would like to call the function "settingSelected(app)" and load the file "name" to a struct called var. However, I haven't been able to make the settingSelected function to work.
Any help would be great.
Thanks!
function getfile(app)
files = dir(fullfile('path where I saved files', '*.mat'));
for i = 1:size(files,1)
app.mitem = uimenu(app.OpenUserSettingsMenu,'Text',files(i).name); % creates childrens (with the names of the files inside path) for Open User Settings menu bar
app.mitem.MenuSelectedFcn = @setttingSelected(app,files(i).name)
end
end
function settingSelected(app,name)
var = load(name);
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by