What does ~= means in image segmentation??

조회 수: 6 (최근 30일)
begginer01
begginer01 2017년 9월 13일
댓글: Image Analyst 2017년 9월 14일
Hello...
What does this error means? How to resolve it?? Please help this is related to MRF segmentation
Error message:
Subscripted assignment dimension mismatch.
Error in EnergyOfLabelField
E(:,i)=sum(Nei8~=i,2);
I don't know how to resolve it....Please help me and solve this issue.. I am attaching my code too so that you can check. Please reply asap.

채택된 답변

Image Analyst
Image Analyst 2017년 9월 13일
~ means "not", so "Nei8~=i" means "Nei8 not equal to i".
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 9월 13일
The code
E=zeros(n,class_number);
for i=1:class_number
E(:,i)=sum(Nei8~=i,2);
end
assumes that the result of sum(Nei8~=i,2) is a vector of length n. That would happen if Nei8 is a column vector of length n rows, or if it is a 2D array with n rows. It would not be the case if Nei8 is a 3 or more dimensional array, and it would not be the case if Nei8 is empty.
You should give the command
dbstop if error
and run your code. When it stops, ask it to display n and to display size(Nei8): if Nei8 is not n x something then you have a problem.
Image Analyst
Image Analyst 2017년 9월 14일
It will throw an error on this line first:
Nei8=imstack2vectors(NeiX(segmentation));
because NeiX was not passed in or defined within the function. Who wrote this weird code for you anyway? Can't you ask the author?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by