Filter löschen
Filter löschen

Clusters lables for fuzzy c mean

1 Ansicht (letzte 30 Tage)
shawin
shawin am 27 Dez. 2020
Kommentiert: Walter Roberson am 31 Dez. 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 Kommentare
Image Analyst
Image Analyst am 27 Dez. 2020
whos X
whos U
What do you see in the command window?
shawin
shawin am 27 Dez. 2020
Bearbeitet: shawin am 28 Dez. 2020
Whos U
Name Size Bytes Class Attributes
U 3x1363 32712 double
---------------------------------------------------------------------
Whos X
Name Size Bytes Class Attributes
X 1363x2 21808 double
------------------------------------------------------------------------
How can we solve this issue, i can not change U ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Dez. 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 Kommentare
shawin
shawin am 28 Dez. 2020
Error using max
MAX with two matrices to compare and two output arguments is not supported.
Error in FCMtest (line 15)
[~,labels]=max(U,1);
Walter Roberson
Walter Roberson am 31 Dez. 2020
[~, labels] = max(U, [], 1);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Clustering finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by