Check the below demo code:
% A random data
N = 10000 ;
x = rand(N,1) ;
y = rand(N,1) ;
% Number of classes
NC = 10 ;
% apply kmeans
idx = kmeans([x y],NC) ;
% cluster the data
data= cell(NC,1) ;
figure
hold on
for i = 1:NC
data{i} = [x(idx==i),y(idx==i)] ;
plot(data{i}(:,1),data{i}(:,2),'.','color',rand(1,3))
end