Plotting in GUI of Matlab

2 次查看(过去 30 天)
JA
JA 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