xor value always get zero
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
ARJUN K P
am 10 Feb. 2016
Kommentiert: the cyclist
am 10 Feb. 2016
img=img('lena.bmp');
i=10;
j=10;
img(i,j)
the result is 158
after i xor with 255
xor(img(i,j),255)
the result is wrong... always get zero...
how to get correct xored value?
1 Kommentar
the cyclist
am 10 Feb. 2016
I don't think I would say that the result is wrong. I would say that the xor function doesn't do what you think it does.
Can you tell us what you need your function to actually do?
Akzeptierte Antwort
Guillaume
am 10 Feb. 2016
xor is a logical operator that either return 0 (if both inputs are 0 or both inputs are not 0) or 1 (if one of the input is 0 but not the other).
>>bitxor(158, 255)
ans =
97
1 Kommentar
the cyclist
am 10 Feb. 2016
Upvote for you, my friend. I bet you're right, I was confident there was a function for it, and I wish I had known it. :-)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!