You may achieve this functionality using the 'SelectionChangedFcn' property of the 'uitabgroup'. The following code provides a simple example of this functionality:
f = figure;
t = uitab;
t.Title = 'Tab1';
t2= uitab;
t2.Title = 'Tab2';
tabgroup = f.Children;
tabgroup.SelectionChangedFcn = @doNothing;
function doNothing(tabgroup, eventData)
tabgroup.SelectedTab = eventData.OldValue;
end
The figure generated from the example code has two tabs and does not allow users to switch to the second one. This functionality is achieved by defining the 'doNothing' function to retrieve the previously-selected tab and set the new-selected tab of the 'uitabgroup' to be that old tab. The 'uitabgroup' is accessed through the 'Children' of the figure. However, depending on the end goal, you may prefer to access the 'uitabgroup' through the 'Parent' property of the 'uitab' that you create.
Best Answer