Isolating and Plotting Individual Cluster

I have the code, which does the Gaussian Mixture Model Clustering on a set of data.
file1='test.csv';
test_data=csvread(file1,1,0);
test_gated= log10(test_data(:,4:5)+200);
X = test_gated(:,1:2);
options = statset('Display','final');
gm = fitgmdist(X,4,'CovarianceType','full','Options',options);
idx = cluster(gm,X);
cluster1 = (idx == 1); % |1| for cluster 1 membership
cluster2 = (idx == 2); % |2| for cluster 2 membership
cluster3 = (idx == 3);
cluster4 = (idx == 4);
figure(1)
gscatter(X(:,1),X(:,2),idx)
legend('Cluster 1','Cluster 2','Cluster 3','Cluster 4','Location','best')
This is my output, which gives me 4 clusters.
How would I be able to get any one of the specific clusters, and plot that isolated cluster on a graph? I am stuck and don't know the direction to go towards. Where would I start? Any help will be appreciated. Thank you!

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by