Animating a 2-D Array as a function of time

8 ビュー (過去 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 Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by