필터 지우기
필터 지우기

Clusters lables for fuzzy c mean

조회 수: 1 (최근 30일)
shawin
shawin 2020년 12월 27일
댓글: Walter Roberson 2020년 12월 31일
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
Image Analyst
Image Analyst 2020년 12월 27일
whos X
whos U
What do you see in the command window?
shawin
shawin 2020년 12월 27일
편집: shawin 2020년 12월 28일
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 ?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 28일
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
shawin
shawin 2020년 12월 28일
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 2020년 12월 31일
[~, labels] = max(U, [], 1);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Clustering에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by