HELP Plotting hourly time series data
Show older comments
I am trying to write a code for a timeseries that will be used to analyse 3-months worth of hourly data sets (such as temperature, windspeeds ect) however, for some reason I can only seem to get it to plot the monthly time scales.. any help on how to datetick to mm dd yy HH mn?
uvFile = 'C:/Users/darcy/OneDrive/Desktop/Darcy/temp and detections/TEMPTOC.csv';
fid = fopen(uvFile,'r');
fgets(fid) %9 numbers of titles columns, data columns are in yyyy-mm-d(check)
fclose(fid);
fid = fopen(uvFile,'r');
%this loop instructs title columns before data starts to be skipped
for i = 1 : 1
fgets(fid);
end
c = 0;
%the numbers below indicate the column numbers which the data is found for
%the computer to read them
while ~feof(fid)
clear tmp;
tmp = fgets(fid);
c = c + 1
MM(c) = str2num(tmp(1:2));
dd(c) = str2num(tmp(4:5));
yy(c) = str2num(tmp(7:8));
HH(c) = str2num(tmp(10:11))
mn(c) = str2num(tmp(13:14))
ss(c) = str2num(tmp(16:17))
dc(c) = str2num(tmp(22:34));
end
fclose(fid);
%check the data looking
figure(1); clf
plot(dn,dc,'b-')
xlabel('Time')
ylabel('Wind Speed')
set(gca,'fontsize',12)
datetick
grid on
legend('Wind Speed')
dn = datenum(yy,mm,dd,H,M,S)
Accepted Answer
More Answers (0)
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!