creating time date matrix
Mostra commenti meno recenti
I want to create an hourly date/time (366 x24) matrix starting from 2000-01-01 and ending 2000-12-31. It must start at midnight 00:00 and end at 23:00 for each day. I would also like each new day to begin in a new row. How do i do that?
Risposta accettata
Più risposte (1)
Akira Agata
il 8 Feb 2018
OK, here is more generalized script. Writing this way, you can flexibly change the starting and ending date, and generate the corresponding matrix.
startDay = datetime(2000,1,1);
endDay = datetime(2015,12,31);
T = startDay + hours(0:23);
nDays = days(endDay - startDay);
T = repmat(T,nDays+1,1);
T = T + days(repmat((0:nDays)',1,24));
1 Commento
vedesh Mohit
il 10 Feb 2018
Categorie
Scopri di più su Calendar in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!