how do xor to cell array1*1?
Mostra commenti meno recenti
X=
1×1 cell array
{'10000000'}
Y=
1×1 cell array
{'01000000'}
Z=xor(X,Y)
Z={'11000000'}
Risposta accettata
Più risposte (1)
Try this:
X = {'10000000'};
Y = {'01000000'};
Z = bitxor(bin2dec(X{1}), bin2dec(Y{1})) % A decimal number.
% Convert to binary digits.
Z = dec2bin(Z) % Correct
% Poster say the answer should be:
Z={'00111111'} % ? Huh?
I'm not sure you understand the concept of XOR. It's one, or the other, but not both. So where both bits match up the output is zero and where they are different it's one.
You can put Z into a cell if you want
Z = {dec2bin(Z)}
1 Commento
reta jon
il 27 Mar 2022
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!