How to remove leap year dates from time series in data
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
peter huang
am 25 Jan. 2022
Kommentiert: peter huang
am 17 Feb. 2022
How to remove leap year(2/29) dates from time series in data
(My time series is hour by hour)
3 Kommentare
Rik
am 25 Jan. 2022
What did you try? It should be easy enough to test whether a specific datenum or datetime is February 29th.
Akzeptierte Antwort
Murugan C
am 25 Jan. 2022
[numDat,txtDat,rawDat] = xlsread('moving_windown_test.xlsx');
leafYecount = 1;
for i1 = 1 : size(rawDat,1)
str_data = num2str(rawDat{i1,1});
f = datetime(str2double(str_data(1:4)),str2double(str_data(5:6)),str2double(str_data(7:end)));
fe = datestr(f,'dd/mm');
if strcmp(fe,'29/02')
disp(['Leaf Year ' datestr(f)]);
leafYe(leafYecount) = i1;
leafYecount = leafYecount + 1;
end
end
rawDat(leafYe',:) = [];
xlswrite('removedLeafYear',rawDat);
3 Kommentare
Murugan C
am 27 Jan. 2022
Please run my code. After that you can open 'removedLeafYear.xlsx' you can see removed leaf year.
Did you run my code.?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!