Filter löschen
Filter löschen

Creating a timeseries using number of rows

2 Ansichten (letzte 30 Tage)
Anaya Kharwadkar
Anaya Kharwadkar am 19 Okt. 2020
Beantwortet: Ameer Hamza am 19 Okt. 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.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 19 Okt. 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;

Weitere Antworten (0)

Kategorien

Mehr zu Variables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by