MATLAB: How to xor a and b now

xoring hex

I want to xor 2 hex values.
reshape(dec2bin(hex2dec(str(:)),4).',1,[])
I convert 2 hex values to binary using these and store it in a and b.
How to xor now?
Cant get using bitxor.
Is there an alternative.
I want two user inputted hex

Best Answer

Using the fact that XOR is basically a "not equals" operator for bits:
a = your first converted binary string
b = your second converted binary string
result = char((a~=b)+'0');