function B=distanceab()
[file,path]=uigetfile({'*.xls','Excel文档'},'选择文件');
if file==0
return;
end
A=xlsread([path file]);n=size(A,1);
if n>362
msgbox('数据量太大,excel将无法保存!','警告');
end
B=[];h=waitbar(0,'数据处理中,请等待...');
for i=1:(n-1)
j=(i+1):n;
B=[B;[repmat(A(i,:),n-i,1),A(j,:),sqrt(sum((repmat(A(i,:),n-i,1)-A(j,:)).^2,2))]];
waitbar(i/(n-1),h,'数据处理中,请等待...');
end
waitbar(1,h,'数据处理完毕!');
pause(.5);
delete(h);pause(eps);
if n>362
return;
end
[file,path]=uiputfile({'*.xls','Excel文档'},'输出结果');
if file
xlswrite([path file],B,strcat('A1:E',num2str(size(B,1))));
else
msgbox('你放弃了保存','消息框');
end
温馨提示:答案为网友推荐,仅供参考