how to XOR binary matrix

1 Ansicht (letzte 30 Tage)
Jennifer Steven
Jennifer Steven am 2 Jun. 2017
Kommentiert: Jennifer Steven am 3 Jun. 2017
hi ... how to XOR bianry matrix as : [0 1 0 1 1 1 0 0 1 0 1 1] in away that Xoring tow digits together then xor the result with the third bit,,, and do this for the rest of the matrix. And save the result as matrix. starting from right to left.
please help needed.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Jun. 2017
final_xor_result = mod( sum(YourVector), 2 )
That is, if there are an even number of 1 bits, then the result of the xor is false, and if there are an odd number of 1 bits, then the result of the xor is true. You do not need to do the xor explicitly, just count the bits that are on.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by