What does ~= means in image segmentation??

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.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 13 Sep. 2017

1 Stimme

~ means "not", so "Nei8~=i" means "Nei8 not equal to i".

3 Kommentare

begginer01
begginer01 am 13 Sep. 2017
how can i resolve..do u want to give an idea about that? what type of value should i use?
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.
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?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by