Create a new UIAxes for every new tab in a tab group in app designer
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Kevin Holly
2022-7-18
Andrew,
Please see the app attached for guidance. Let me know if you have any questions.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!