How to display axes objects in uitab?
5 views (last 30 days)
Show older comments
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;
0 Comments
Answers (1)
Joost
on 6 May 2020
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, ...)
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!