"Subscripted assignment dimension mismatch." error matlab
이전 댓글 표시
Hi,
I do not know why I have "Subscripted assignment dimension mismatch." error at line u(i,j)=1./sum_d;. Below is my coding:
%update U
for i=1:nc
for j=1:o
sum_d=0;
for k=1:nc
sum_d = sum_d + (distance(c(i,:),x(j,:))/distance(c(k,:),x(j,:)))^(2/(m_exponent-1));
end
u(i,j)=1./sum_d;
end
end
Hope to get the solution soon.Thanks.
채택된 답변
추가 답변 (1개)
Star Strider
2014년 3월 2일
I suggest you run this statement separately (it’s now part of your sum_d statement)
(distance(c(i,:),x(j,:))/distance(c(k,:),x(j,:)))^(2/(m_exponent-1));
and check its dimensions. It might be a vector, meaning that sum_d will be a vector.
This line
u(i,j)=1./sum_d;
wants sum_d to be a scalar.
댓글 수: 5
Ong Teng
2014년 3월 2일
Star Strider
2014년 3월 2일
d = (distance(c(i,:),x(j,:))/distance(c(k,:),x(j,:)))^(2/(m_exponent-1));
Ong Teng
2014년 3월 2일
Ong Teng
2014년 3월 4일
카테고리
도움말 센터 및 File Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!