You could do this using the callbacks of the button property
ax = figure('Name','First GUI');
selectButton1 = uicontrol('Parent',ax,'Style','pushbutton','String',"Select",...
'Units','normalized',...
'Position',[.325 .25 .05 .5],...
'Callback', @(h,e)firstCallback(ax));
function firstCallback(ax)
ay = figure('Name','Second GUI');
selectButton2 = uicontrol('Parent',ay,'Style','pushbutton','String',"Select",...
'Units','normalized',...
'Position',[.325 .25 .05 .5],...
'Callback', @(h,e)secondCallback(ax));
end
function secondCallback(ax)
close(ax);
end
Here the first GUI has a button(selectButton1), upon clicking opens 2nd GUI with another button(selectButton2). On clicking of selectButton2 the first GUI closes.
You can go on nesting them like the example above.