Hello,
I am working with uitabgroup and uitabs?
I would like to be able to hide or delete a uitab.
Does any one have a solution to this problem.
Thank you very much

 Akzeptierte Antwort

Adam
Adam am 30 Okt. 2015
Bearbeitet: Adam am 30 Okt. 2015

6 Stimmen

You can reparent the tab to empty as e.g.
f = figure;
tabgp = uitabgroup(f,'Position',[.05 .05 .3 .8]);
tab1 = uitab(tabgp,'Title','Type of Signal');
tab2 = uitab(tabgp,'Title','Plot Options');
tab1.Parent = [];
then
tab1.Parent = tabgp;
to bring it back again.
The problem is that the tab returns in a different order to previously since what was the 2nd tab originally became the first (and only in this example) tab when you reparent the first one, so when you bring the first one back it adds it to the end.
You can fix this though by permuting the
tabgp.Children
back to the same order you originally had.
I just tried inserting the tab directly into the 'Children' array but it does not allow you to do that so this is the only solution I can think of off the top of my head.

5 Kommentare

Scott Urquhart
Scott Urquhart am 30 Okt. 2015
Thanks Adam, that solved it.
Lucademicus
Lucademicus am 8 Mär. 2019
Somehow, when I set the parent of some tabs to [], when I close the figure, a new and empty figure initializes. Can somebody explain this behavior? (r2017b and r2018b)
it also can reach in this way:
f = figure;
tabgp = uitabgroup(f,'Position',[.05 .05 .3 .8]);
tab1 = uitab(tabgp,'Title','Type of Signal');
tab2 = uitab(tabgp,'Title','Plot Options');
tabgp.Chileren(1).delete;
cheng sy
cheng sy am 22 Mär. 2019
this way may be more simple and understood。
Adam
Adam am 22 Mär. 2019
Bearbeitet: Adam am 22 Mär. 2019
Sure, if you want to delete a tab then delete it directly:
delete( tab1 );
but hiding it implies you will want to see it again at some point, which you can't do if you have deleted it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Stalin Samuel
Stalin Samuel am 30 Okt. 2015

0 Stimmen

set(uitab_handle,'Visible','off')
Scott Urquhart
Scott Urquhart am 30 Okt. 2015
Bearbeitet: Walter Roberson am 13 Aug. 2020

0 Stimmen

This doesn't work (for me).
handles.tabgp = uitabgroup('Position',[0.006 0.470 0.99 0.44],'Visible','on'); handles.tab1 = uitab(handles.tabgp,'Title','TAB1');
set(handles.tab1,'Visible','off')
Error using matlab.ui.container.Tab/set There is no Visible property on the Tab class.

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by