- Open the app in MATLAB App Designer.
- Go to 'Code View' and inspect the 'StartupFcn' or any other initialization functions for code that adds toolbars or menus. For example, you can look for lines like:
Duplicating lines of menu/toolbar when running the APP
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
Recently I had an issue with my MATLAB app. Everytime I open the app, it added lines of toolbars and menu to itself. Deleting them and save will fix the issue for one time but when I open the app next time, it again automatically adds lines of toolbars and menu to itself.

Did anyone encounter similar issue? And what's your solution to it?
Thanks everyon!
Best
Zach
0 Kommentare
Antworten (1)
Anushka
am 20 Feb. 2025
I was able to reproduce this behaviour at my end. Based on my observations, you can follow the mentioned workaround to stop duplication of toolbars and menus:
uimenu(f, 'Text', 'New Menu');
uitoolbar(f);
In case you find such code, you can either remove it or modify it to ensure it only runs once.
3. If you want to keep the tool bar and menu creation code, implement a 'flag' to ensure it executes only once:
properties (Access = private)
MenuCreated = false;
end
function startupFcn(app)
if ~app.MenuCreated
createMenuAndToolbar(app);
app.MenuCreated = true;
end
end
By following these steps, your app should no longer add duplicate toolbars and menus each time it opens.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown 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!