Santorini1010 2017-04-19 06:35 采纳率: 0%
浏览 8091

未定义与 'struct' 类型的输入参数相对应的函数 'minus'。

如题,这是什么意思?怎么解决
程序F = load ('2.mat') ;
%% K-means
K = 6; % Cluster Numbers
KMI = 20; % K-means Iteration
CENTS = F( ceil(rand(K,1)*size(F,1)) ,:); % Cluster Centers
DAL = zeros(size(F,1),K+2); % Distances and Labels
CV = '+r+b+c+m+k+yorobocomokoysrsbscsmsksy'; % Color Vector

for n = 1:KMI

for i = 1:size(F,1)
for j = 1:K

DAL(i,j) = norm(F(i,:) - CENTS(j,:)); (显示这里的错误)

end
[Distance, CN] = min(DAL(i,1:K)); % 1:K are Distance from Cluster Centers 1:K
DAL(i,K+1) = CN; % K+1 is Cluster Label
DAL(i,K+2) = Distance; % K+2 is Minimum Distance
end
for i = 1:K
A = (DAL(:,K+1) == i); % Cluster K Points
CENTS(i,:) = mean(F(A,:)); % New Cluster Centers
if sum(isnan(CENTS(:))) ~= 0 % If CENTS(i,:) Is Nan Then Replace It With Random Point
NC = find(isnan(CENTS(:,1)) == 1); % Find Nan Centers
for Ind = 1:size(NC,1)
CENTS(NC(Ind),:) = F(randi(size(F,1)),:);
end
end
end

%% Plot

clf
figure(1)
hold on

for i = 1:K
PT = F(DAL(:,K+1) == i,:); % Find points of each cluster

plot(PT(:,1),PT(:,2),CV(2*i-1:2*i),'LineWidth',2); % Plot points with determined color and shape
plot(CENTS(:,1),CENTS(:,2),'*k','LineWidth',7); % Plot cluster centers
end

hold off
grid on
pause(0.1)

end

  • 写回答

1条回答 默认 最新

  • newer92 2017-12-05 14:29
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 写uniapp时遇到的问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流