MATLAB: How to programmatically select a tab in a uitabgroup

MATLABuitabuitabgroup

Is it possible to programmatically select one of the tabs in a uitabgroup? In response to a user request, I need to recreate the tabs and their contents, but I'd like to keep the original choice of tab. When the tabs are created, tab 1 is always selected.
tabgroup.SelectedTab is a read-only property; I tried writing to it (on the chance that it would work) and nothing happened.
Thanks!

Best Answer

You can set it using SelectedTab of the uitabgroup:
tg = uitabgroup;
tt(1) = uitab('Parent',tg);
tt(2) = uitab('Parent',tg);
tt(3) = uitab('Parent',tg);
tg.SelectedTab = tt(2);
(R2014b)
Related Question