function [t1,ti] = thin1(cprop,clusters,K)
% t1 = thin1(cprop,K)
%      THin clusters based on size: >= K
[mp np] = size(cprop);
[m n] = size(clusters);
zerol = zeros(max(max(clusters)));
ti = clusters;
index = 0;
for i1 = 1:mp
  if cprop(i1,1) >= K
    index = index+1;
    zerol(i1) = i1;
    for j1 = 1:np
      t1(index,j1) = cprop(i1,j1);
    end
  else
    zerol(i1) = 0;
  end
end

for i1 = 1:m
  for j1 = 1:n
    if ti(i1,j1)>0
      if zerol(ti(i1,j1))==0
        ti(i1,j1) = 0;
      end
    end
  end
end

      