Plotting in GUI of Matlab

1 Ansicht (letzte 30 Tage)
JA
JA am 24 Aug. 2016
Beantwortet: Bjorn Gustavsson am 24 Aug. 2016
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

Antworten (1)

Bjorn Gustavsson
Bjorn Gustavsson am 24 Aug. 2016
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

Community Treasure Hunt

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

Start Hunting!

Translated by