clear; clc;

opt = detectImportOptions('^GSPC.csv');
sp500 = readtable('^GSPC.csv', opt);
sp500.Date = datetime(sp500.Date, 'format', 'uuuu-MM-dd');

twii = readtable('^TWII.csv', opt);
twii.Date = datetime(twii.Date, 'format', 'uuuu-MM-dd');

mergeed_table = outerjoin(sp500, twii, 'Keys', 'Date', ...
                          'mergekeys', true);
head(mergeed_table)
stackedplot(mergeed_table, {'AdjClose_sp500', 'AdjClose_twii'}, ...
            'xvariable', 'Date'); grid on;