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

29 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by