# How to separate data sets/clusters that got saved in a single data file?

2 Ansichten (letzte 30 Tage)
Raju Kumar am 16 Mai 2023
Kommentiert: Cris LaPierre am 19 Mai 2023
I have this follwing data. Col 1: Vertical Pixels, Col 2: Horizontal Pixels, Col 3: Index of 256x256 pixels, Col 4: Data 1, Col 5: Data 2. When I plot Col 3 and Col 5 (as shown in the figure) using 'imagesc', there appear two seprate clusters each containing a part of values from Col 5. My question is how do I extract the data or columns correponding to each cluster without visualizing it. Any leads will be highly appreciated. Many thanks.
9 77 19464 410575406 13
15 73 18446 410575406 11
17 74 18704 410575406 12
12 77 19467 410575406 17
9 76 19208 410575408 1
16 74 18703 410575406 13
11 77 19466 410575406 31
10 77 19465 410575406 21
16 73 18447 410575406 34
15 74 18702 410575406 80
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Cris LaPierre am 16 Mai 2023
kmeans clustering algorithm?
data = [9 77 19464 410575406 13
15 73 18446 410575406 11
17 74 18704 410575406 12
12 77 19467 410575406 17
9 76 19208 410575408 1
16 74 18703 410575406 13
11 77 19466 410575406 31
10 77 19465 410575406 21
16 73 18447 410575406 34
15 74 18702 410575406 80]
data = 10×5
9 77 19464 410575406 13 15 73 18446 410575406 11 17 74 18704 410575406 12 12 77 19467 410575406 17 9 76 19208 410575408 1 16 74 18703 410575406 13 11 77 19466 410575406 31 10 77 19465 410575406 21 16 73 18447 410575406 34 15 74 18702 410575406 80
img = zeros(256);
img(data(:,3)) = data(:,5);
imagesc(img)
xlim([68 82])
ylim([7 20])
idx = kmeans(data(:,1:2),2);
figure
gscatter(data(:,2),data(:,1),idx)
axis image
axis ij
xlim([68 82])
ylim([7 20])
##### 4 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
Raju Kumar am 19 Mai 2023
@Cris LaPierre Thanks but this finds more k even when there should not be any. I have found a way by applying logical thoughts looking at the data. But I appreciate your answers.
Cris LaPierre am 19 Mai 2023
Without having the actual data, it's hard to say for certain what would work. You have something working, wich is great. My next thought would be to look into some image processing techinques, like blob analysis perhaps?

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Gaussian Mixture Models finden Sie in Help Center und File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by