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))]

1 件のコメント

mahaveer hanuman
mahaveer hanuman 2011 年 7 月 20 日
thanks

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Structures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by