[~, sheets] = xlsfinfo('Data.xlsx');
lattables = cell(size(sheets));
for sh = 1:numel(sheets)
latitude = sscanf(strrep(sheets{sh}, '_', '.'), 'Lat%f');
lattables{sh} = readtable('Data.xlsx', 'Sheet', sheets{sh});
lattables{sh}.Latitude = repmat(latitude, height(lattables{sh}), 1);
end
fulltable = vertcat(lattables{:});
fulltable = stack(fulltable, 4:8, 'ConstantVariables', [1:3, 9], 'NewDataVariableName', 'TEC', 'IndexVariableName', 'Longitude');
fulltable.Longitude = sscanf(strrep(strjoin(cellstr(fulltable.Longitude)), '_', '.'), 'Long%f ')
Best Answer