How to display axes objects in uitab?

5 visualizaciones (últimos 30 días)
Philipp
Philipp el 30 de Abr. de 2020
Respondida: Joost el 6 de Mayo de 2020
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;

Respuestas (1)

Joost
Joost el 6 de Mayo de 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, ...)

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by