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일

0 개 추천

xor(I(1:2:end), I(2:2:end))

댓글 수: 3

mahaveer hanuman
mahaveer hanuman 2011년 7월 20일
as n=90 i should get 30 out put but i am getting 45.
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일

1 개 추천

I = reshape(rand(1,N)>0.5),2,[]).';
[I, xor(I(:,1),I(:,2))]

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by