Creating callbacks to children in menus

1 visualización (últimos 30 días)
Luis Pantin
Luis Pantin el 16 de Jul. de 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

Respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by