필터 지우기
필터 지우기

use of the 'uitab'

조회 수: 6 (최근 30일)
zhiping
zhiping 2011년 6월 17일
hello, I use 'uitab' to create many uitabs, finally I want to initial all the parametres, how to remove all of uitabs except one? Thanks in advance. Here is the example:
function example
k=1;
screensize=get(0,'ScreenSize');
h(1)=figure('Name','example','Color',[0.831372549019608 0.815686274509804 0.784313725490196],...
'Position',[100 100 screensize(3)-500 screensize(4)-400],'NumberTitle','off','Resize','off','MenuBar','none');
h(10) = uitabgroup('Parent',h(1),'Position',[0.2 0.6 0.92 0.33]);
h(14) = uicontrol('Parent',h(1),'Units','normalized','Callback',@pushbutton3_Callback,...
'Position',[0.1 0.8 0.1 0.15],'String','Add uitab','Style','pushbutton','Enable','on');
h(15) = uicontrol('Parent',h(1),'Units','normalized','Callback',@pushbutton4_Callback,...
'Position',[0.1 0.6 0.1 0.15],'String','initial','Style','pushbutton','Enable','on');
function pushbutton3_Callback(obj,event)
create_tab(k);
k=k+1;
end
function pushbutton4_Callback(obj,event)
k=1;
h(10) = uitabgroup('Parent',h(1),'Position',[0.2 0.6 0.92 0.33]);
create_tab(k);
end
function create_tab(idx)
h(11+100*(idx-1)) = uitab('Parent',h(10),'Title',['tab' num2str(idx)]);
end
end
I use a button to initial the parametre, made k=1, but it doesn't look right.
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2011년 6월 17일
How did you create many uitabs? Please show your example.
zhiping
zhiping 2011년 6월 20일
I add my example.

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 6월 20일
First of all, reformat your code portion of your question as {}Code so it's more readable to human eyes. By first glimpse, your function didn't have the right input argument. The only input to your create_tab(idx) function is the variable idx. But inside the function, you are using h(10) as the handle of the parent GUI.
  댓글 수: 1
zhiping
zhiping 2011년 6월 20일
hi, I'm a little stupid, just make k=1, and re-write h(10),then callback create_tab(k), the problem is solved. Anyway, thinks a lot.

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

추가 답변 (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