How can I xor a and b now?
2 views (last 30 days)
Show older comments
Adarsh Santhosh
on 20 Jan 2018
Commented: Adarsh Santhosh
on 20 Jan 2018
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
0 Comments
Accepted Answer
James Tursa
on 20 Jan 2018
Edited: James Tursa
on 20 Jan 2018
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');
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!