How to compress x-axis with datetime values so that only the times with datapoints are displayed?

조회 수: 3 (최근 30일)
Dear all,
I am having issues with plotting data over datetime. The dataset cointains data from the 19.10.2016 11pm UTC - 20.10.2016 08pm UTC. However, plotting the data with
time = datetime(data.Time_UTC, 'InputFormat', 'HH:mm:ss');
date = datetime(data.Date, 'InputFormat', 'dd-MM-yyyy');
Datetime = date + timeofday(time);
figure;
subplot(3,2,1);plot(datenum(Datetime),evap,'.');xlabel('time');ylabel('Evap (mm/h)');grid;datetick('x', 'yyyy-mm-dd')%title(['Ts= ' num2str(ts(1)) ' Ta= ' num2str(t(1)) ' RH= ' num2str(rh(1)) ' Wave Age= ' num2str(Wa(1))]);
subplot(3,2,2);plot(datenum(Datetime),ebulk,'.');xlabel('time');ylabel('Evap (mm/h)');grid;datetick('x', 'yyyy-mm-dd')%title(['Ts= ' num2str(ts(1)) ' Ta= ' num2str(t(1)) ' RH= ' num2str(rh(1)) ' Wave Age= ' num2str(Wa(1))]);
subplot(3,2,3);area(datenum(Datetime),evap_acm);xlabel('time');ylabel('Evap acm (mm)');grid;datetick('x', 'yyyy-mm-dd')
subplot(3,2,4);area(datenum(Datetime),ebulk_acm);xlabel('time');ylabel('Evap acm (mm)');grid;datetick('x', 'yyyy-mm-dd')
subplot(3,2,5);plot(datenum(Datetime),shflux,'.');xlabel('time');ylabel('Sensible Heat Flux (W/m^2)');grid;datetick('x', 'yyyy-mm-dd')
subplot(3,2,6);plot(datenum(Datetime),lhflux,'.');xlabel('time');ylabel('Latent Heat Flux (W/m^2)');grid;datetick('x', 'yyyy-mm-dd')
leads to this:
but I actually want only the Data which actually contains data - can anyone help?
Thanks in advance!!

답변 (0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by