function [station_no, station_dn] = ASOS_id station_no = []; station_dn = {}; [filename, pathname]= uigetfile('*.txt','Select ASOS station index file (WBAN-MSC.TXT)'); if any(pathname~=0) full_filename = fullfile( pathname, filename ); else wrn = warndlg({'Selection of ASOS station index file cancelled:', 'Descriptive names for ASOS stations will be unavailable'},'Warning: ASOS index file missing'); uiwait(wrn); return; end fid = fopen( full_filename ); file_contents = textscan( fid, '%s', 'whitespace', '', 'delimiter', '\n','bufSize',10000000); file_contents = file_contents{1}; station_count = 0; for i=9:length(file_contents) textline = file_contents{i}; if length(textline)>17 && ~isempty(str2num(textline(1:6))) station_count = station_count+1; station_no(station_count)=str2num(textline(1:6)); station_dn{station_count}=textline(17:end); end end if station_count ==0 err = warndlg({'Unexpected format in selected file:', 'Descriptive names for ASOS stations will be unavailable'},'Error reading ASOS index file'); uiwait(err); return; else save('ASOS_stations.mat', 'station_no', 'station_dn'); end