I would like to expand an existing timetable. The original timetable consists of trading days only, while I would like to expand it to reflect all weekdays (no matter if working day or not).
Consider the original timetable tt
. I would like to expand it using the RowTimes
vector datesWeekdays
. The expanded rows should contain NaNs.
When playing around, I was wondering if it makes sense to firstly create a new timetable comprising all dates and setting the data to NaN and subsequently "integrate" the original timetable tt
into the new timetable ttWeekdays
.
Here's a toy example:
data = rand(3,2);
dates = datetime({'2018-04-30', '2018-05-02', '2018-05-03'}, 'InputFormat','yyyy-MM-dd');
tt = array2timetable(data, 'RowTimes', dates, 'VariableNames', {'high', 'low'})
datesWeekdays = datetime({'2018-04-30', '2018-05-01', '2018-05-02', '2018-05-03', '2018-05-04'}, 'InputFormat','yyyy-MM-dd');
dataWeekdays = nan(5,2);
ttWeekdays = array2timetable(dataWeekdays, 'RowTimes', datesWeekdays, 'VariableNames', {'high', 'low'})