XOR operation

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

채택된 답변

Oleg Komarov
Oleg Komarov 2011년 7월 20일
xor(I(1:2:end), I(2:2:end))
  댓글 수: 3
mahaveer hanuman
mahaveer hanuman 2011년 7월 20일
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 2011년 7월 20일
See walter's solution.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 7월 20일
I = reshape(rand(1,N)>0.5),2,[]).';
[I, xor(I(:,1),I(:,2))]
  댓글 수: 1
mahaveer hanuman
mahaveer hanuman 2011년 7월 20일
thanks

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by