Duplicate subplots within loop
Mostrar comentarios más antiguos
Hi everyone,
i would like to duplicate plots in 2 subplots with different axis settings within a loop. What i want to do is to duplicate the plot from the first subplot and then change the axis properties. If i start with something like this:
x = linspace(-2*pi,2*pi,100);
figure
for i=1:100
y = sin(x+i);
subplot(2,1,1)
hCurve = plot(x,y,'r');
drawnow
subplot(2,1,2)
hSub2 = subplot(2,1,2);
copyobj(hCurve,hSub2);
drawnow
end
the top subplot gets refreshed every iteration, while for the bottom subplot the hold property seems to be on. Changing this property via axis handle doesn't seem to work. I suspect the copyobj function is the key, but how do i achieve the same behavior on both plots?
Thank you very much!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Subplots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!