classdef testgui < matlab.apps.AppBase
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
tab_a matlab.ui.container.Tab
tab_b matlab.ui.container.Tab
NormalButton matlab.ui.control.Button
ButtonGroup matlab.ui.container.ButtonGroup
RButton1 matlab.ui.control.RadioButton
RButton2 matlab.ui.control.RadioButton
UIAxes matlab.ui.control.UIAxes
WelcomeLabel matlab.ui.control.Label
end
methods (Access = public)
function app = testgui(app)
app.start_app_tab_a()
pause(1)
app.create_tab_b()
app.tab_b.Parent = app.TabGroup;
app.TabGroup.SelectedTab = app.tab_b;
end
function app = start_app_tab_a(app)
app.UIFigure = uifigure();
app.UIFigure.Position = [100 100 800 500];
app.UIFigure.Name = 'UI Figure';
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [1 1 800 500];
app.TabGroup.Visible = "on";
app.tab_a = uitab(app.TabGroup);
app.tab_a.Title = "Tab A";
app.WelcomeLabel = uilabel(app.tab_a);
app.WelcomeLabel.Position = [250 250 200 20];
app.WelcomeLabel.Text = 'Wait here until Tab B looks fine';
end
function app = create_tab_b(app)
app.tab_b = uitab(app.TabGroup);
app.tab_b.Title = "Tab B";
app.tab_b.Parent = [];
app.UIAxes = uiaxes(app.tab_b);
app.UIAxes.Position = [200 200 400 250];
pause(3)
plot(app.UIAxes,randi(5,20,1),randi(5,20,1))
app.NormalButton = uibutton(app.tab_b, 'push');
app.NormalButton.Position = [300 100 80 25];
app.NormalButton.Text = 'Button0';
app.ButtonGroup = uibuttongroup(app.tab_b);
app.ButtonGroup.Position = [400 100 100 90];
app.RButton1 = uiradiobutton(app.ButtonGroup);
app.RButton1.Text = 'Option A';
app.RButton1.Position = [5 50 90 20];
app.RButton2 = uiradiobutton(app.ButtonGroup);
app.RButton2.Text = 'Option B';
app.RButton2.Position = [5 20 90 20];
app.RButton2.Value = true;
app.RButton1.Value = false;
end
end
end