HOW TO INSERT THE DATE (DATETIME) IN THE PRINT?

22 ビュー (過去 30 日間)
DUMITRU ROBERT GUGIU
DUMITRU ROBERT GUGIU 2020 年 12 月 19 日
回答済み: Matt Gaidica 2020 年 12 月 19 日
clear all; clc;
%% parte dedicata a lettura dati OK !
ncfile='04072015A30122019.nc';
ncinfo(ncfile);
ncdisp(ncfile);
lon=ncread(ncfile,'lon');
lati=ncread(ncfile,'lat');
d=ncread(ncfile,'VHM0');
%% import time dimension DUBBI SUL 2 PUNTO !
time = ncread(ncfile,'time');
date_matlab = datetime(time, 'convertfrom','posixtime');
formatOut = ' dd, mm, yyyy HH:MM:SS.FFF';
formatOut = 'ddmmyyyy';
tt=datestr(time,formatOut);
gg=num2str(tt);
figure
for t=2:2:10
%:24:length(time)
startLoc = [1 1 t];
count = [Inf Inf 1];
d = ncread(ncfile,'VHM0',startLoc,count);
d=d';
xx=d;
hmax(t)=max(max(xx));
hmax= hmax'
clf
mymap=pcolor(lon,lati,xx);hold on
mymap.EdgeAlpha=0;
contourf(lon,lati,xx,7,'ShowText','on')
load coast
hold on
plot(long,lat+0.1,'black')
caxis([0 1])
sr=colorbar
sr.Label.String = 'm';
xlabel('longitudine');
ylabel('latitudine');
caption = sprintf('%s','Hs [m]' , date_matlab(t),'[UTC]',' Altezza max ', hmax(t));
caption1 = sprintf('%s', date_matlab(t));
title(caption,'FontSize', 10, 'FontWeight', 'bold', 'Color', 'b');
print(['HSIGN_calma' (caption1(t)) '.png'],'-dpng'); %% I WANT TO INSERT THE DATE HERE%%%
% % % VALOREMINIMO=min(min(d));
end
%
% end

採用された回答

Matt Gaidica
Matt Gaidica 2020 年 12 月 19 日
print(['HSIGN_calma' (caption1(t)) datestr(now,'yyyymmdd_HHMMSS') '.png'],'-dpng');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by