How can I read informations of an ASCII header

1 view (last 30 days)
Sina Pinter
Sina Pinter on 21 Feb 2019
Answered: KSSV on 21 Feb 2019
I have this type of ascii file:
ncols 1001
nrows 1001
xllcorner 32463999.5
yllcorner 6099999.5
cellsize 1
nodata_value -999.00
-0.50 -0.49 -0.50 -0.53 -0.58 -0.61 -0.60 -0.57 ...
so how can I read the header information xllcorner and yllcorner ?
thansk a lot xoxo

Answers (1)

KSSV
KSSV on 21 Feb 2019
fid = fopen('data.txt') ;
count = 0 ;
iwant = zeros(5,1) ;
while 1
count = count+1 ;
tline = strsplit(fgetl(fid)) ;
iwant(count) = str2num(tline{2}) ;
if count == 5
break
end
end
fclose(fid) ;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!