Creating a timeseries using number of rows

2 visualizaciones (últimos 30 días)
Anaya Kharwadkar
Anaya Kharwadkar el 19 de Oct. de 2020
Respondida: Ameer Hamza el 19 de Oct. de 2020
I want to create a timeseries in the format 'dd-mm-yyy hh:mm' and I want the granularity of data to be hourly.
For example, if my first entry is '01-01-2015 00.00', I want the second entry to be '01-01-2015 01:00'
I tried doing the following:
ts1.TimeInfo.StartDate = '04-Jan-2015 00:00'; % Set start date.
ts1.TimeInfo.Format = 'dd-mm-yyyy hh:mm';
ts1.Time = ts1.Time - ts1.Time(1);
but I am getting data by the minute. ie:
04-Jan-2015 00:01
04-Jan-2015 00:02
How to I solve this problem? ANy help would be appreciated.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 19 de Oct. de 2020
Try something like this
t1 = datetime('04-Jan-2015 00:00', 'Format', 'dd-MM-yyyy HH:mm');
t2 = datetime('07-Jan-2015 00:00', 'Format', 'dd-MM-yyyy HH:mm');
t = t1:hours(1):t2;

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by