How can I group cluster data?

조회 수: 1 (최근 30일)
Sabari Pramanik
Sabari Pramanik 2018년 7월 27일
답변: Rushil 2025년 3월 24일
I have some D dimension points, say 30 points of 5 dimension each. Now i make cluster from them using "clusterdata". now i want to group them according to the cluster number. How can i do this?

답변 (1개)

Rushil
Rushil 2025년 3월 24일
Hello
You can group your datapoints by their cluster indices after using the “clusterdata” function. Here, I assume that your data is in the form of a matrix (in this case 30-by-5). After using “clusterdata”, you can create a cell array and store all the datapoints that correspond to that cluster index using logical indices. Below is sample implementation that may help you:
data = rand(30,5); % placeholder data
numClusters = 3; % you may change this value
clusterIndices = clusterdata(data,'Maxclust',numClusters);
clusteredData = cell(numClusters,1);
for k = 1:numClusters
clusteredData{k} = data(clusterIndices==k,:);
fprintf('Cluster %d:\n',k);
disp(clusteredData{k});
end
Here is the documentation link for “clusterdata” which has been used above:

카테고리

Help CenterFile Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by