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

22 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Matt Gaidica
Matt Gaidica il 19 Dic 2020
print(['HSIGN_calma' (caption1(t)) datestr(now,'yyyymmdd_HHMMSS') '.png'],'-dpng');

Più risposte (0)

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by