南海流场日变化动态图
f3=figure(3);
day=31;
for d=1:day
uu=squeeze(u(:,:,d)); % 252 x 241
vv=squeeze(v(:,:,d)); % 252 x 241
% uu=uu';vv=vv';
% 另一种转置方式
uu=permute(uu,[2 1 3]);vv=permute(vv,[2 1 3]);
m_proj('Miller','lat',[5,25],'lon',[105,125]);
t=5;
m_quiver(Lon(1:t:end,1:t:end),Lat(1:t:end,1:t:end),uu(1:t:end,1:t:end),vv(1:t:end,1:t:end),5);
m_gshhs_i('LineWidth',1,'Color',[0.5 0.5 0.5]);
m_grid('box','fancy','YaxisLocation','right','tickdir','in','linestyle','none','fontsize',12);
m_text(106,24,[num2str(d) '-Jan-2000'],'fontsize',12,'FontAngle','italic');
m_text(106,23,'m/s','fontsize',12,'FontAngle','italic');
title(['fluid on Jan ' num2str(d) 'st']);
xlabel('Longitude');
ylabel('Latitude');
drawnow
frame=getframe(f3);
im{d}=frame2im(frame);
end
file = ‘filename.gif'; % Specify the output file name
for d = 1:day
[A,map] = rgb2ind(im{d},256);
if d == 1
imwrite(A,map,file,'gif','LoopCount',Inf,'DelayTime',1);
else
imwrite(A,map,file,'gif','WriteMode','append','DelayTime',1);
end
end
本文来自博客园,作者:dan-chen,转载请注明原文链接:https://www.cnblogs.com/dan-chen/p/10781230.html
---------------
小陈的学习历险记