use of the 'uitab'
5 次查看(过去 30 天)
显示 更早的评论
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
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.
更多回答(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!