How can I read informations of an ASCII header

1 次查看(过去 30 天)
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

回答(1 个)

KSSV
KSSV 2019-2-21
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) ;

类别

Help CenterFile Exchange 中查找有关 Low-Level File I/O 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by