12345678910111213141516171819202122 |
- function [iCminDist]=QuantHammingAllOfTheCanonicalIndices(CWidx,AllCentSet)
- N=size(CWidx,1);
- M=size(AllCentSet,1);
- iCminDist=zeros(1,N);
- idxs=1:M;
- pperc=[];
- for ii=1:N
-
- % Approximation of half of the hamming distance
- dH=sum(bsxfun(@ne,AllCentSet,repmat(CWidx(ii,:),M,1))');
- allOfTheMins=idxs(dH==min(dH));
- iCminDist(ii)=allOfTheMins(randi(length(allOfTheMins)));
- %[~,iCminDist(ii)]=min(dH);
-
- perc=sprintf('%2.2f%%',ii/N*100);
- fprintf(1,'%s',sprintf('\b')*ones(1,length(pperc)));
- fprintf(1,'%s',perc);pperc=perc;
- end
- fprintf(1,'%s',sprintf('\b')*ones(1,length(pperc)));
- end
|