Plotting in GUI of Matlab

조회 수: 1 (최근 30일)
JA
JA 2016년 8월 24일
답변: Bjorn Gustavsson 2016년 8월 24일
Until now i had only 1 axes in my GUI to I used to just plot directly using plot command. Plus i need to plot these in a loop.
for i = 1:length(sig)
plot(sig(i).time,sig(i).signal,sig(i).time,updated(i).filter,sig(i).time)
hold on
end
Now i have 2 axes in my GUI, how i make a certain plot appear in 1 plot and another in my 2nd plot

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2016년 8월 24일
Keep the handles to the axes you create:
axs(1) = subplot(1,2,1);
axs(2) = subplot(1,2,2);
Then make the axes you want to plot on the current axes before plotting:
for i1 = 1:17,
g = randn(1);
if g > 0
axes(axs(2))
plot(randn(1,23),'linewidth',2,'color',rand(1,3))
hold on
else
axes(axs(1))
plot(randn(1,23),'linewidth',1,'color',rand(1,3))
hold on
end
end
HTH

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by