Animating a 2-D Array as a function of time

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일

0 개 추천

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월 23일
Howdy. This works as I was envisioning, but there seems to be an axis inversion. I think at the for loop, but I could be wrong. I was hoping to have the x-axis be 1:8 and the y-axis be the data from the array.
No problemo
here you are
ppdtrace = 0.75+0.5*rand(1200,8);
x = (1:8)';
figure(1)
p = plot(x,ppdtrace(1,:)','*','markersize',18); %// initiallize plot. Get a handle to graphic object
axis([0 10 0 2]); %// 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', x, 'YData', ppdtrace(k,:)');
end
Owen
Owen 2025년 1월 24일
Much appreciated!
as always, my pleasure !

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

질문:

2025년 1월 23일

댓글:

2025년 1월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by