%cwprint.m
function cwprint(DisMat)
% %filename为文本文件文件名,a为矩阵行数(样本数),b为矩阵列数(变量指标数)
% fid=fopen(filename,'r');
% vector=fscanf(fid,'%g',[a b]);
% fprintf('标准化结果如下:\n')
load dis.mat
DisMat=dis;
vector = DisMat;
v1=cwstd(vector);
result=cwfac(v1)
[a,~] = size(DisMat);
x = zeros(1,a);
for i = 1:a
x(1,i) = i;
end
y = x;
% for i = 1:a-1
% for j = i:a
% dis(i,j) = 0;
% end
% end
figure(1)
surf(x,y,DisMat);
tmp = max(max(DisMat));
[c1,d1]=find(DisMat == tmp);
c=c1(1,1);
d=d1(1,1);
h = zeros(1,a);
for i = 1:a
if(DisMat(d,i) < DisMat(c,i) )
h(1,i) = 1;
else
h(1,i) = 2;
end
end
re1 = find(h == 1);
re2 = find(h == 2);
figure(2)
for i = 1 : 161
AISdata = textread([num2str(i),'.txt']);
X = squeeze(AISdata(:,1));
Y = squeeze(AISdata(:,2));
if(find(re1 == i))
plot(X,Y,'r','linewidth',1.5);
hold on
else
plot(X,Y,'g','linewidth',1.5);
hold on
end
if(i == c)
plot(X,Y,'k','linewidth',1.5);
hold on
end
if(i == d)
plot(X,Y,'k','linewidth',1.5);
end
end
cwscore(v1,result);