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 Center および File ExchangeDevelop 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