필터 지우기
필터 지우기

How to display axes objects in uitab?

조회 수: 8 (최근 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 CenterFile Exchange에서 Interactive 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