Create a new UIAxes for every new tab in a tab group in app designer

조회 수: 4 (최근 30일)
Andrew Feenan
Andrew Feenan 2022년 7월 18일
답변: Kevin Holly 2022년 7월 18일
Hi,
The code below is he code I'm using to create a new tab in a tab group when a 'New Tab' button is pushed.
function NewTab(app,src,event)
if app.tabNum < 11
app.NTcontainer = uitab(app.TabGroup2,'Title',[num2str(app.tabNum)]);
NewTabPageSetup(app)
app.tabNum = app.tabNum + 1;
else
message = sprintf('The maximum number of tabs has been reached. \nDelete a tab and try again.');
uialert(app.UIFigure,message,'Warning')
end
end
In the NewTabPageSetup function I setup all elements on the new tab page except the UIAxes as I need a new axis for each tab.
I have tried creating a new axis for each tab like this:
I know this code is wrong.
function AxisFunction(app)
AxisPosition = [281,59,531,428];
selectedTab = app.T
for i = 2:8
NewAxis(i) = uiaxes(app.NTcontainer);
NewAxis(i).Position = AxisPosition;
NewAxis(i).XGrid = "on";
NewAxis(i).YGrid = "on";
end
NTAxis = NewAxis(selectedTab)
end
function DistributionFitterTabGroupSelectionChanged(app, event)
app.T = app.DistributionFitterTabGroup.SelectedTab.Title;
AxisFunction(app)
end
I would really appreciate if someone could help or just point me in the right direction.
Andrew

답변 (1개)

Kevin Holly
Kevin Holly 2022년 7월 18일
Andrew,
Please see the app attached for guidance. Let me know if you have any questions.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by