Filter löschen
Filter löschen

Creating callbacks to children in menus

2 Ansichten (letzte 30 Tage)
Luis Pantin
Luis Pantin am 16 Jul. 2020
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

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by