QuantHammingAllOfTheCanonicalIndices.m 656 B

12345678910111213141516171819202122
  1. function [iCminDist]=QuantHammingAllOfTheCanonicalIndices(CWidx,AllCentSet)
  2. N=size(CWidx,1);
  3. M=size(AllCentSet,1);
  4. iCminDist=zeros(1,N);
  5. idxs=1:M;
  6. pperc=[];
  7. for ii=1:N
  8. % Approximation of half of the hamming distance
  9. dH=sum(bsxfun(@ne,AllCentSet,repmat(CWidx(ii,:),M,1))');
  10. allOfTheMins=idxs(dH==min(dH));
  11. iCminDist(ii)=allOfTheMins(randi(length(allOfTheMins)));
  12. %[~,iCminDist(ii)]=min(dH);
  13. perc=sprintf('%2.2f%%',ii/N*100);
  14. fprintf(1,'%s',sprintf('\b')*ones(1,length(pperc)));
  15. fprintf(1,'%s',perc);pperc=perc;
  16. end
  17. fprintf(1,'%s',sprintf('\b')*ones(1,length(pperc)));
  18. end