Animating a 2-D Array as a function of time

조회 수: 6 (최근 30일)
Owen
Owen 2025년 1월 23일
댓글: Mathieu NOE 2025년 1월 31일
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!

채택된 답변

Mathieu NOE
Mathieu NOE 2025년 1월 23일
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
Owen
Owen 2025년 1월 24일
Much appreciated!
Mathieu NOE
Mathieu NOE 2025년 1월 31일
as always, my pleasure !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by