I think you are looking to find exact match, so for that you may use this -
%%// If *ANY* of the element-wise comparisons are not-true, give me 1,
%%// otherwise give me 0. Thus, in other words, I am looking to find the
%%// exact match (element-wise) only, otherwise give me 1 as x.
if any(A~=[1 1 0 0] & A~=[1 0 1 0] & A~=[1 1 0 1])
x=1;
else
x=0;
end
Another way to put it would be -
%%// *ALL* elementwise comparisons must be satisfied, to give x as 0,
%%// otherwise give x as 1.
if all(A==[1 1 0 0] & A==[1 0 1 0] & A==[1 1 0 1])
x=0;
else
x=1;
end
Get more info about any and all, that are used here.
x=1?