Getting parity

12 visualizaciones (últimos 30 días)
mahaveer hanuman
mahaveer hanuman el 30 de Jul. de 2011
num = 100; source = randint(num,2); it is a 2x100
i should first row elements and j should be 2nd row elemntshow can i do it
parity = mod(source(i)+ source(j),2);

Respuestas (2)

Paulo Silva
Paulo Silva el 30 de Jul. de 2011
code from your other question, fixed by me:
num = 100; source = randint(num,2);
r1 =source(1,:); r2 =source(2,:); parity = mod(r1+r2,2);
hope it's all correct
  2 comentarios
mahaveer hanuman
mahaveer hanuman el 30 de Jul. de 2011
i want to run for all 100 bits
Paulo Silva
Paulo Silva el 30 de Jul. de 2011
num = 100; source = randint(num,2);
parity = mod(source(:,1)+source(:,2),2)

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 30 de Jul. de 2011
num = 100; source = randint(num,2);
parity = xor(source(:,1), source(:,2));
  1 comentario
mahaveer hanuman
mahaveer hanuman el 31 de Jul. de 2011
thanks for your help

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by