Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB working with uitab

In working with MATLAB's uitab, I had two specific questions:

  1. How do I remove a tab that has been created using uitab function?

  2. How do I clear the contents of such a tab (including diagrams, buttons, etc.) without deleting the tab itself?

like image 900
Feri Avatar asked Jan 24 '26 11:01

Feri


1 Answers

In order to remove a uitab from a uitabgroup but not delete the graphics object, you can change the 'Parent' property to [].

hgroup = uitabgroup();

htab = uitab(hgroup, 'Title', 'Tab');

button = uicontrol('Parent', htab, 'String', 'Button');

% Don't show the uitab
set(htab, 'Parent', []);

Then if you want to display the tab again, change the 'Parent' property back to the tab group that you'd like it to belong to.

set(htab, 'Parent', hgroup)

If you want to clear a tab, you can delete all of the 'Children' of that tab

delete(get(htab, 'Children'))
like image 149
Suever Avatar answered Jan 27 '26 19:01

Suever



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!