Animating a 2-D Array as a function of time
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Owen
el 23 de En. de 2025
Comentada: Mathieu NOE
el 31 de En. de 2025
Hi,
I'm trying to construct an animation for a 1200x8 array named 'ppdtrace' that returns the entire row data in a stepwise manner. I'm hoping to track the evolution of these data at points 1:8 across 1200 time steps. So, it would read in the data from row 1 and plot the return values along the y-plane with whole numbers [1:8] on the x-plane. What I have currently uses the animatedline function and plots it with:
h=animatedline('MaximumNumPoints',100);
for i=1:1200
for l=1:8
addpoints(h,l,ppdtrace(i,l));
drawnow;
end
end
Which evolves as I was predicting, but I would prefer to have only data points denoted as 'o' , 'x' , or something of this manner, without the lines between. Is there a function that I can use to achieve this, or perhaps a command I can use to manipulate the animatedline function?
Alternatively, I would be fine with continuing to use animatedline if there was a way to prevent the function from connecting the data point at position 8 in the (n)th row with the data point at position 1 in the n+1 row.
Thanks!
0 comentarios
Respuesta aceptada
Mathieu NOE
el 23 de En. de 2025
not really sure to understand how it should look like , but maybe .... this ?
ppdtrace = 0.75+0.5*rand(1200,8);
figure(1)
p = plot((1:8)',ppdtrace(1,:)','*','markersize',18); %// initiallize plot. Get a handle to graphic object
axis([0 2 0 10]); %// freeze axes to their final size, to prevent Matlab from rescaling them dynamically
for k=2:1200
% update the plot
pause(0.05)
set(p, 'XData', ppdtrace(k,:)', 'YData', (1:8)');
end
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!