gusucode.com > 《模式识别与智能计算》matlab源代码 > 《模式识别与智能计算》matlab源代码/《模式识别与智能计算》部分函数的源程序/书程序/第8章/calimport.m

    function [pos,num,gama]=calimport(x1,x2)   

temp=delrepeat([x1 x2]);    
x1=temp(:,1:end-2);
x2=temp(:,end-1);
y1=equvalue(x1);  
r1=length(y1);
y2=equvalue(x2);  
r2=length(y2);
y=cell(1,r2);

for i=1:r2   
    for j=1:r1
      y3=calculatelow(y1{j}(:,end)',y2{i}(:,end)',1);  
       if  ~isempty(y3)
          y{i}=[y{i} y3];
       end
    end    
end
pos=[];
for i=1:r2-1
   a=union(y{i},y{i+1});
   pos=[pos a];
end
pos=unique(pos);
num=length(pos);
gama=num/size(x1,1);