XOR operation

5 vues (au cours des 30 derniers jours)
mahaveer hanuman
mahaveer hanuman le 20 Juil 2011
I=rand(1,N)>0.5 N=90 xor operation should done for each two bits . and out put should be corresponding two bit followed with result. pls help me

Réponse acceptée

Oleg Komarov
Oleg Komarov le 20 Juil 2011
xor(I(1:2:end), I(2:2:end))
  3 commentaires
mahaveer hanuman
mahaveer hanuman le 20 Juil 2011
if I=[0 1 0 1 0 0 1 1 1 0 1 0 0......90bits]
i should get X=xor (first two bit and correspond)
x(0)=[0 1 1]x1=[0 1 1]x2=[0 0 0]x3=[1 1 0]................
Oleg Komarov
Oleg Komarov le 20 Juil 2011
See walter's solution.

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 20 Juil 2011
I = reshape(rand(1,N)>0.5),2,[]).';
[I, xor(I(:,1),I(:,2))]
  1 commentaire
mahaveer hanuman
mahaveer hanuman le 20 Juil 2011
thanks

Connectez-vous pour commenter.

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by