how to extract previous week and month number of same hour?
Ältere Kommentare anzeigen
I had load data of one year, half houly data of load (1*17520), I want to add a column having load data of previous week (same day & time period) and another column having previous day data at same time slot
We can keep blank for initial week/day data because for that previous data is not available here.
5 Kommentare
KSSV
am 16 Jun. 2020
You split the date availables into days, months, years, hours, minutues, seconds using datevec. You can use indexing of months and time you want and get the value you want.
MUKESH KUMAR
am 16 Jun. 2020
KALYAN ACHARJYA
am 16 Jun. 2020
You can do it in multiple ways, it would be better to clear, if you can attach one same file
MUKESH KUMAR
am 16 Jun. 2020
Steven Lord
am 17 Jun. 2020
KSSV: if MUKESH KUMAR has the date and time data stored as a datetime array or as the time vector in a timetable, there's no need to split that data to jump backwards a day or a week.
d = datetime('now')
dMinusWeek = d - calweeks(1)
dMinusDay = d - caldays(1)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!