If I have already created an App, but then want to add Tabs, is it better to do this through the App Designer interface or "programmatically"? Any hints to expedite the process?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
That is, there is code existing already, so if I add "Tabs", how do I get my existing code into the Tab of my choice?
- Should I (for example...) start an entirely new App and begin with Tabs? Or
- Add Tabs to my existing App using the App Designer interface, and rearrange the existing App code into the tabs? Or,
- Add tabs _ programmatically,_ and put the new Tab code so as to encompass the existing code that I want on that Tab?
- Other ???
0 Commenti
Risposte (1)
TED MOSBY
il 20 Ago 2025 alle 8:16
Hi,
If your tabs are static (i.e., not created/destroyed dynamically based on data), the fastest approach is to use App Designer’s Component Library: drop in a Tab Group, create a few tabs, and move your existing components under the right tabs.
If you need tabs at runtime (e.g., variable number of tabs), then you can create them programmatically in startupFcn and reparent existing controls into the desired tab.
% Create a Tab Group and two tabs
app.TabGroup = uitabgroup(app.UIFigure);
t1 = uitab(app.TabGroup, 'Title','Data');
t2 = uitab(app.TabGroup, 'Title','Plots');
% Reparent existing components into tabs
app.LoadButton.Parent = t1;
app.UIAxes.Parent = t2;
Here is some documentation for reference:
Hope it helps!
0 Commenti
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!