Hello Peter, Try the below solution :
station = [];
SheetName = {'CTD 2014'; 'CTD 2015'; 'CTD 2016'; 'CTD 2017'; 'CTD 2018'; 'CTD 2019'};
FileName = 'SBE 19plus CTD Profiling Database.xlsx';
for sheet_idx = 1:length(SheetName)
opts = detectImportOptions(FileName,'Sheet',SheetName{sheet_idx});
[station_raw] = readtable(FileName,opts);
station_raw = station_raw.Station;
station_raw(strcmp(station_raw,'-')) = [];
station_raw(strcmp(station_raw,'?')) = [];
station_raw = station_raw(~cellfun(@isempty, station_raw));
station = [station; station_raw];
end
I hope this helps...!
Best Answer