function cluster = dbscan(M, Eps, MinPts) cluster = zeros(size(M,1),1); classcounter = 0; doLoop = 1; while(doLoop) classcounter = classcounter + 1; notClassified = find(cluster == 0); if(sum(notClassified) == 0) doLoop = 0; else cluster(notClassified(1)) = classcounter; cluster = dbrec(notClassified(1), M, Eps, MinPts, cluster); end end antal(max(cluster)) = 0; for i = 1:size(M,1) antal(cluster(i)) = antal(cluster(i)) + 1; end temp = find(antal < 3); for i = 1:size(temp,2) cluster(find(cluster == temp(i))) = 0; end