How can I save an animated plot as a GIF?

138 ビュー (過去 30 日間)
Esther Wayntraub
Esther Wayntraub 2023 年 3 月 31 日
回答済み: Les Beckham 2023 年 3 月 31 日
Hello, I am working with the FOCUS Ultrasound code downloaded from the FOCUS website. I have this piece of code:
figure();
for it = 1:nt,
mesh(z*100, x*100, squeeze(p_tsd(:, :, :, it)))
title(['FNM TSD Example, t = ', sprintf('%0.3f',(it/fs) * 1e6), '\mu','s'])
zlabel('pressure (Pa)')
xlabel('z (cm)')
ylabel('x (cm)')
temp=axis();
temp(5)=-maxpressure;
temp(6)=maxpressure;
axis(temp);
drawnow
end
This provides me with a plot that is animated and shows me each piece getting plotted. I want to save this as a GIF for a presentation. However, when I save the figure, it only saves the final image, not the entire animation. How can I save the animation?

回答 (1 件)

Les Beckham
Les Beckham 2023 年 3 月 31 日

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by