现在的位置: 首页 > 综合 > 正文

[Z,R] = arcgridread(filename);读取小数问题

2014年05月20日 ⁄ 综合 ⁄ 共 401字 ⁄ 字号 评论关闭

[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);

【上篇】
【下篇】

抱歉!评论已关闭.