You can use the function any to find out if any of the variables is equal to any other variable.
any(a==[b c d])
will gave a logical 1 if 'a' is matching with any of the other variables.
You can see how to write a function here.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!