用arcgis提取出的ascii文件,导入matlab中textread读取不了出现:
错误使用 dataread
从文件(第 1 行,第 1 个字段)中读取 number 时出现问
题 ==>
出错 textread (第 124 行)
[varargout{1:nlhs}]=dataread('file',varargin{:}); %#ok
以下是代码内容,希望能给出具体一点的修改方法,鄙人不胜感激!

function Search_WaterHead(FlowAcc,FlowDir,LeftX,DownY,cellsize,ouletX,ouletY,Ac)
%
% FlowAcc
% cellsize
% Line87
format long;
[m,n]=size(FlowAcc);
UpY=DownY+cellsize*m;
Ac=floor(Ac/(cellsize^2)); %
len_ouletX=length(ouletX);
stepPoint=[]; WaterHead=[];
num_ToPoint=0; %
num_slope=0; %
%
for ilen=1:len_ouletX
%
startRow=floor((UpY-ouletY(ilen))/cellsize)+1;
startCol=floor((ouletX(ilen)-LeftX)/cellsize)+1;
stepPoint=[stepPoint;[startRow,startCol,FlowAcc(startRow,startCol),0,0]];
empty_stepPoint=1;
%
while empty_stepPoint
startRow=stepPoint(1,1);
startCol=stepPoint(1,2);
if FlowAcc(startRow,startCol)>=Ac
%
if startCol<n && FlowDir(startRow,startCol+1)==2^4 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow,startCol+1)>Ac
num_ToPoint=num_ToPoint+1; %
%
if FlowAcc(startRow,startCol+1)>Ac; stepPoint=[stepPoint;[startRow,startCol+1,FlowAcc(startRow,startCol+1),startRow,startCol]]; end
%
if FlowAcc(startRow,startCol+1)<=Ac; num_slope=num_slope+1; end
end
if startRow<m && startCol<n && FlowDir(startRow+1,startCol+1)==2^5 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow+1,startCol+1)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow+1,startCol+1)>Ac;stepPoint=[stepPoint;[startRow+1,startCol+1,FlowAcc(startRow+1,startCol+1),startRow,startCol]];end
if FlowAcc(startRow+1,startCol+1)<=Ac;num_slope=num_slope+1;end
end
if startRow<m && FlowDir(startRow+1,startCol)==2^6 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow+1,startCol)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow+1,startCol)>Ac;stepPoint=[stepPoint;[startRow+1,startCol,FlowAcc(startRow+1,startCol),startRow,startCol]];end
if FlowAcc(startRow+1,startCol)<=Ac;num_slope=num_slope+1;end
end
if startRow<m && startCol>1 && FlowDir(startRow+1,startCol-1)==2^7 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow+1,startCol-1)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow+1,startCol-1)>Ac;stepPoint=[stepPoint;[startRow+1,startCol-1,FlowAcc(startRow+1,startCol-1),startRow,startCol]];end
if FlowAcc(startRow+1,startCol-1)<=Ac;num_slope=num_slope+1;end
end
if startCol>1 && FlowDir(startRow,startCol-1)==2^0 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow,startCol-1)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow,startCol-1)>Ac;stepPoint=[stepPoint;[startRow,startCol-1,FlowAcc(startRow,startCol-1),startRow,startCol]];end
if FlowAcc(startRow,startCol-1)<=Ac;num_slope=num_slope+1;end
end
if startRow>1 && startCol>1 && FlowDir(startRow-1,startCol-1)==2^1 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow-1,startCol-1)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow-1,startCol-1)>Ac;stepPoint=[stepPoint;[startRow-1,startCol-1,FlowAcc(startRow-1,startCol-1),startRow,startCol]];end
if FlowAcc(startRow-1,startCol-1)<=Ac;num_slope=num_slope+1;end
end
if startRow>1 && FlowDir(startRow-1,startCol)==2^2 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow-1,startCol)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow-1,startCol)>Ac;stepPoint=[stepPoint;[startRow-1,startCol,FlowAcc(startRow-1,startCol),startRow,startCol]];end
if FlowAcc(startRow-1,startCol)<=Ac;num_slope=num_slope+1;end
end
if startRow>1 && startCol<n && FlowDir(startRow-1,startCol+1)==2^3 % && FlowAcc(startRow,startCol)>Ac % && FlowAcc(startRow-1,startCol+1)>Ac
num_ToPoint=num_ToPoint+1; %
if FlowAcc(startRow-1,startCol+1)>Ac;stepPoint=[stepPoint;[startRow-1,startCol+1,FlowAcc(startRow-1,startCol+1),startRow,startCol]];end
if FlowAcc(startRow-1,startCol+1)<=Ac;num_slope=num_slope+1;end
end
%
if num_slope==num_ToPoint; WaterHead=[WaterHead;[startRow,startCol]]; end
end
num_slope=0; num_ToPoint=0;
stepPoint(1,:)=[]; % %
empty_stepPoint=~isempty(stepPoint);
end
end
WaterHead(:,1)=UpY-WaterHead(:,1).*cellsize+cellsize/2; % row,Y
WaterHead(:,2)=LeftX+WaterHead(:,2).*cellsize-cellsize/2; % Col,X
length_WaterHead=length(WaterHead);
str1='D:\program\head.txt';
str2='Head'; str3='.txt'; % str2=num2str(num1);
Pathi_Out=strcat(str1,str2,str3); % D:\RiverResult\MainDownS200\ProKs\ProKsi.txt
fid=fopen(Pathi_Out,'w');
for j=1:length_WaterHead
fprintf(fid,'%f\t',WaterHead(j,2)); % X-cordinate
fprintf(fid,'%f\n',WaterHead(j,1)); % Y-cordinate
end
fclose(fid);