One approach:
Ej = readtable('Ejemplo.xlsx');
Ej.StartTime = Ej{:,1} + days(Ej{:,2});
Ej.EndTime = Ej{:,1} + days(Ej{:,3});
with:
FirstFiveRows = Ej(1:5,:)
producing:
FirstFiveRows =
5×5 table
Date StartTime EndTime ForecastInMW ActualInMW
___________ ____________________ ____________________ ____________ __________
01-Sep-2010 01-Sep-2010 00:00:00 01-Sep-2010 00:15:00 1037.6 983.3
01-Sep-2010 01-Sep-2010 00:15:00 01-Sep-2010 00:30:00 1071.2 1177.7
01-Sep-2010 01-Sep-2010 00:30:00 01-Sep-2010 00:45:00 1098.5 1397.7
01-Sep-2010 01-Sep-2010 00:45:00 01-Sep-2010 01:00:00 1339.1 1414.4
01-Sep-2010 01-Sep-2010 01:00:00 01-Sep-2010 01:15:00 1360.4 1585.1
EDIT — (8 Sep 2020 at 16:02)
To use my code with 'PreserveVariableNames',true (and avoiding the Warning that appears otherwise), my code changes slightly to:
Ej = readtable('Ejemplo.xlsx', 'PreserveVariableNames',1);
Ej.('Start Time') = Ej{:,1} + days(Ej{:,2});
Ej.('End Time') = Ej{:,1} + days(Ej{:,3});
with:
FirstFiveRows = Ej(1:5,:)
producing:
FirstFiveRows =
5×5 table
Date Start Time End Time Forecast in MW Actual in MW
___________ ____________________ ____________________ ______________ ____________
01-Sep-2010 01-Sep-2010 00:00:00 01-Sep-2010 00:15:00 1037.6 983.3
01-Sep-2010 01-Sep-2010 00:15:00 01-Sep-2010 00:30:00 1071.2 1177.7
01-Sep-2010 01-Sep-2010 00:30:00 01-Sep-2010 00:45:00 1098.5 1397.7
01-Sep-2010 01-Sep-2010 00:45:00 01-Sep-2010 01:00:00 1339.1 1414.4
01-Sep-2010 01-Sep-2010 01:00:00 01-Sep-2010 01:15:00 1360.4 1585.1
.
Best Answer