Getting parity

조회 수: 9 (최근 30일)
mahaveer hanuman
mahaveer hanuman 2011년 7월 30일
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);

답변 (2개)

Paulo Silva
Paulo Silva 2011년 7월 30일
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
mahaveer hanuman
mahaveer hanuman 2011년 7월 30일
i want to run for all 100 bits
Paulo Silva
Paulo Silva 2011년 7월 30일
num = 100; source = randint(num,2);
parity = mod(source(:,1)+source(:,2),2)

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2011년 7월 30일
num = 100; source = randint(num,2);
parity = xor(source(:,1), source(:,2));
  댓글 수: 1
mahaveer hanuman
mahaveer hanuman 2011년 7월 31일
thanks for your help

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by