南海流場日變化動態圖

愛跳廣場舞的小陳發表於2019-03-20

南海流場日變化動態圖

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

相關文章