function ION = cssm()
str = fileread( 'c:\m\cssm\CODG1520.txt' );
ca1 = regexp( str, '(?<=START OF TEC MAP).+?(?=END OF TEC MAP)', 'match' );
ION = nan( 73, 70, 11 );
lat2ix = @(lat) round((lat+87.5)/2.5)+1;
lon2ix = @(lon) round((lon+180)/5.0)+1;
ut2ix = @(ut) round(ut/2)+1;
for jj = 1 : length( ca1 )
buf = regexp( ca1{jj}, '\n', 'split', 'once' );
buf = regexp( buf{2} , '\n', 'split', 'once' );
ut = textscan( buf{1}, '%*f%*f%*f%f%*[^\n]' );
ut = ut{1};
ca2 = regexp( buf{2}, 'LAT/LON1/LON2/DLON/H', 'split' );
pos = ca2{1};
for kk = 2 : length( ca2 )
lat = textscan( pos,'%f%*[^\n]' );
lat = lat{1};
num = sscanf( ca2{kk}(1:end-60), '%f' );
pos = strtrim( ca2{kk}(end-60+1:end) );
ION(:,lat2ix(lat),ut2ix(ut)) = num;
end
end
end
Best Answer