[Z,R] = arcgridread(filename);filename文件为.grd的网格文件,里面的值为浮点数,直接读取的时候出错,只能读取第一个浮点数,而且自动转化为了整数。
在matlab命令行里输入open arcgridread.打开arcgridread.m文件,看它内部实现代码,修改如下即可读取出小数:
% Read the matrix of data values, putting the k-th row in the data
% file into the k-th column of matrix Z. Close file — nothing left to
% read after this.
%%这是系统的%d,下面的%f是自己修改的。
% [Z, count] = fscanf(fid,’%d’,[ncols,nrows]);
[Z, count] = fscanf(fid,’%f’,[ncols,nrows]);
fclose(fid);