Watch this Author's files
This is great code! It's very easy to read and taught me a lot about mean shift.
I found that the runtime was decreased on my machine and data by replacing the lines:
sqDistToAll = sum((repmat(myMean,1,numPts) - dataPts).^2);
beenVisitedFlag(myMembers) = 1;
sqDistToAll = sum(bsxfun(@minus,myMean,dataPts).^2);
beenVisitedFlag(inInds) = 1;
Thanks for the code!