How to display axes objects in uitab?

17 ビュー (過去 30 日間)
Philipp
Philipp 2020 年 4 月 30 日
回答済み: Joost 2020 年 5 月 6 日
Hello,
I'd like to display plotted data in different tabs. With the code I have written only the last tab contains any data. I am guessing it might be because uitab only has one axes and I am assigning the axes wrong.
So any ideas on how to combine the two axes?
Cheers
Philipp
% create the figure everything will be displayed in
figure('Name','Outing Preview','NumberTitle','off');
% SPEED
% call the function plotSpeed with path of file, function returns an axes object
axesSpeed = plotSpeed(path);
% create a new tab within the figure created
tabSpeed = uitab('Title','Speed');
% set the parent of axesSpeed to tabSpeed in order to show the created axes
% in plot Speed within the newly created tab
axesSpeed.Parent = tabSpeed;
% TRACK
% call the function plotTeack with path of file, function returns an axes object
axesTrack = plotTrack(path);
% create a new tab within the figure created
tabTrack = uitab('Title','Track');
% set the parent of axesTrack to tabTrack in order to show the created axes
% in plot Speed within the newly created tab
axesTrack.Parent = tabTrack;

回答 (1 件)

Joost
Joost 2020 年 5 月 6 日
I think you can solve it by first creating a uitabgroup, then creating the uitabs, and finally the plots in the proper tabs.
What I read in the uitab documentation: If there is no tab group available, MATLAB® calls the figure function to create a figure. Then it creates a tab group in that figure, and places the tab inside the tab group.
That might be causing the effect you see.
f = figure;
tg = uitabgroup(f);
tab1 = uitab(tg);
tab2 = uitab(tg);
plot(tab1, ...)
plot(tab2, ...)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by