Create uitab with different name (several uitabs)
3 次查看(过去 30 天)
显示 更早的评论
Actually I have two questions about uitabs 1. Is "is there any problem using uitab in matlab R2014a other then the warning and documentation?" 2. Is " I want to creat a uitab group with several and different uitabs, these uitabs contain different gui components, each uitab is generated when clicking a push button so the user clicks once if he needs one uitab and twice if he needs two and so on, the general code that I use is to gather all gui components in handles structure like
Handles.fig=figure
Handles.Uitbgrp=uitabgroup('parent',handles.fig,position,...)
Handles.pb1=uicontrol(parent...,'callback',@pb1) % pushbutton
.
.
.
N=0;
Function pb1(source,event)
N=N+1
Handles.myTab1=uitab('parent',handles.uitbgrp,....)
I want that the value of handles.myTab1 changes to handles.myTabN each time the push button is triggered so I can manipulate my data easily and clearly in accordance with the overall structure of the program
0 个评论
采纳的回答
Charles
2015-5-29
Instead of changing a number within the name of the tab, simply make an array of tabs. In your example (after fixing a lot of capitalization issues), I come up with teh following:
function test
Handles.fig=figure;
Handles.Uitbgrp=uitabgroup('parent',Handles.fig);
Handles.pb1=uicontrol('parent',Handles.fig,'callback',@pb1) % pushbutton
N=0;
function pb1(source,event)
N=N+1;
Handles.myTab(N)=uitab('parent',Handles.Uitbgrp);
end
end
This code creates an array of tab objects as Handles.myTab(), numbered sequentially. Much better than unique alpha names, as now you can programatically reach each object. I did not embellish at all, you will need to add tab titles, button name, etc. etc.
Chuck
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!