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!