Let the app with the button be called app1 and the app with the tab group be called app2. In app2, let the tab group be called TabGroup and the two tabs be called Tab1 and Tab2.
Within app1,
- Add a property (I will call it app2_handle)
- Add a startupFcn callback to the UIFigure
- In the startupFcn, call the constructor for app2 and assign the handle to app2_handle.This function in app1 looks like:
function startupFcn(app)
app.app2_handle = app2();
end
This makes app1 open an instance of app2. Now you can manipulate app2 from app1.
- Add a ButtonPushed callback to the button in app1.
- In ButtonPushed, use app2_handle to manipulate the SelectedTab. An example of this function could be:
function ButtonPushed(app, event)
selected = app.app2_handle.TabGroup.SelectedTab;
if (selected == app.app2_handle.Tab1)
app.app2_handle.TabGroup.SelectedTab = app.app2_handle.Tab2;
else
app.app2_handle.TabGroup.SelectedTab = app.app2_handle.Tab1;
end
end