MATLAB:帮忙修改一个小程序!!!!!Index exceeds matrix dimensions错误
MATLAB里的width.m文件如下:出现 ???Index exceeds matrix dimensions错误,应该怎么修改???
function w = width( c )
[n,m]=size(c);
w = zeros(n,1);
x=[];
for i=1:n
for j=1:n
x(j)=(norm(c(i,:)-c(j,:)))^2;
end
a=sort(x);
b1=a(2);
b2=a(3);
w(i,:)=(b1+b2)/2^0.5;
end