time animation of a 3D matrix

20 ビュー (過去 30 日間)
Thomas Holmes
Thomas Holmes 2019 年 3 月 21 日
コメント済み: Thomas Holmes 2019 年 3 月 21 日
I have a 14x14x221 matrix, A, where the Z component is time. I need to make a colored animation of how the X and Y components change with time. The code I have written now just creates a new figure for each iteration of the loop so it produces 221 figures that appear after closing out of the previous figure.
Q=length(A);
for i=1:Q
W=A(:,:,Q);
pcolor(W);
drawnow
pause(0.3)
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 21 日
Q = size(A,3);
W = A(:,:,1);
h = pcolor(W);
drawnow();
pause(0.3);
for K = 2 : Q
W = A(:,:,K);
set(h, 'CData', W);
drawnow();
pause(0.3);
end
  1 件のコメント
Thomas Holmes
Thomas Holmes 2019 年 3 月 21 日
Thank you!

サインインしてコメントする。

その他の回答 (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