Azzera filtri
Azzera filtri

How to display axes objects in uitab?

8 visualizzazioni (ultimi 30 giorni)
Philipp
Philipp il 30 Apr 2020
Risposto: Joost il 6 Mag 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;

Risposte (1)

Joost
Joost il 6 Mag 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, ...)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by