Extracting time from timestamp
이전 댓글 표시
I have a dataset that looks like this (a csv file)

I need to plot temperature of 5 days vs time (in hours)
I seem to be stuck on trying to extract the time in hours from the timestamp. I HAVE TRIED using "hours" but if you observe carefully, if i just use hours, then what happens is that under the hour "14" both entries of "14:00" and "14:30" come, essentially, 2 datavalues for 1 datapoint. This is creating a nightmare graph for me

Any help is greatly appreciated.
x = humidity_site1;
hday1 = x(674:721);
hday2 = x(722:769);
hday3 = x(770:817);
hday4 = x(818:865);
hday5 = x(866:913);
tday1 = hour(y(675:722));
tday2 = hour(y(722:769));
tday3 = hour(y(770:817));
tday4 = hour(y(818:865));
tday5 = hour(y(866:913));
plot(tday1,hday1,tday2,hday2,tday3,hday3,tday4,hday4,tday5,hday5)
legend('Mar 15','Mar 16','Mar 17','Mar 18','Mar 19');
figure
plot(tday1,hday1)
%I imported the data as separate column vectors using the "Import Data"
%tool
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!