필터 지우기
필터 지우기

Create uitab with different name (several uitabs)

조회 수: 1 (최근 30일)
Zine
Zine 2015년 2월 17일
댓글: Zine 2015년 6월 5일
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

채택된 답변

Charles
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
  댓글 수: 1
Zine
Zine 2015년 6월 5일
Thanks very much, it works very well, also my uicontrols I used them as arrays, thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by