Since ‘x’ is a matrix, you need to use either any, all, sum or some other function that produces the appropriate scalar.
x = 1:4;
f = 2;
q = x~=f
1 0 1 1
What do you want the comparison to do? I’m certain it would like to know!
EDIT — When you evaluate:
they are still going to be (1x4) vectors.