フィルターのクリア

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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by