Clusters lables for fuzzy c mean
1 view (last 30 days)
Show older comments
shawin
on 27 Dec 2020
Commented: Walter Roberson
on 31 Dec 2020
Hi,
I have used MATLAB code for fuzzy c mean clustering :
X= data set.
[centers,U] = fcm(X,3)
labels = ones(size(X,1),1);
for i = 1:size(X,1)
aux = U(i,:);
[elem,index] = max(aux);
labels(i,1) = index;
end
but I have an error which is :
Index exceeds matrix dimensions
Error in FCMtest (line 27)
aux = U(i,:);
Please could you determine where is the issue ?
2 Comments
Accepted Answer
Walter Roberson
on 28 Dec 2020
Replace
for i = 1:size(X,1)
aux = U(i,:);
[elem,index] = max(aux);
labels(i,1) = index;
end
with
[~, labels] = max(U, 1);
2 Comments
More Answers (0)
See Also
Categories
Find more on Data Clustering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!