how to extract previous week and month number of same hour?
Mostrar comentarios más antiguos
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 comentarios
KSSV
el 16 de Jun. de 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
el 16 de Jun. de 2020
KALYAN ACHARJYA
el 16 de Jun. de 2020
You can do it in multiple ways, it would be better to clear, if you can attach one same file
MUKESH KUMAR
el 16 de Jun. de 2020
Steven Lord
el 17 de Jun. de 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)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!