K-means algorithm sometimes doesn't converge, help

#1General_ZimbadPosted 5/7/2013 4:45:39 AM
http://pastebin.com/wsutz5an

It's in matlab. I am not used to matlab so sorry on the terrible quality. The main issue is that it fails to converge when the input data gets too big (data > 100 elements), especially when it's given > 2 clusters. The data must be given as a 2 by n matrix, where the two columns represent the x values and y values respectively.

Not even sure if is correct, but I think it should be.
#2General_Zimbad(Topic Creator)Posted 5/7/2013 4:46:39 AM
On a side note, going to bed. Won't be able to answer questions for a bit.
#3General_Zimbad(Topic Creator)Posted 5/7/2013 5:20:24 PM
Disregard this. Found out my implementation of the algorithm works fine. I was just being an idiot and testing it with randomly generated data with no clusters.