idx = kmeans(img,4,'emptyaction','singleton'); clusteredImage = zeros(size(X_no_dither)); clusteredImage(sub2ind(size(X_no_dither) , m(:,1),m(:,2)))=idx;
imshow(label2rgb(clusteredImage))
??? Error using ==> sub2ind at 58 Out of range subscript.
Error in ==> test at 29 clusteredImage(sub2ind(size(X_no_dither) , m(:,1),m(:,2)))=idx;