MATLAB: How to check the variables are equal or not

MATLABoperators

if a=rt && b=rt
h=h+1;
elseif a~=rt && b=rt
f=f+1;
elseif a=rt && b~=rt
m=m+1;
elseif a~=rt && b~=rt
c=c+1;
end
Is this correct or I wanted to use double equal to '==' to check it

Best Answer

You have to use
==
or
isequal
or
strcmp
or
ismember
or any other function that compares variables. = is only for allocation.
Related Question