필터 지우기
필터 지우기

problem with XOR bits

조회 수: 1 (최근 30일)
Dija
Dija 2014년 11월 29일
댓글: Dija 2014년 11월 29일
Hello everybody I convert the numbers from 0 to 7 to binary like it’s shown here
N=8;
r=3
for N=0:1:N-1
A=dec2bin(N,r)
end
i have to calculate the XOR of each number(bit by bit)with 1=>A xor 1 i explain for 1 for example 1=0 0 1 I have to do 0 XOR 0 than the result which is 0 with the 3rd one(0 XOR 1) and the result with 1 i'm struggling please help me

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 11월 29일
편집: Azzi Abdelmalek 2014년 11월 29일
N=8;
r=3
A=zeros(N,r)
out=zeros(N,1)
for k=0:1:N-1
A(k+1,:)=dec2bin(k,r)-'0'
out(k+1,1)=xor(xor(A(k+1,1),A(k+1,2)),A(k+1,3))
end
[A out]
  댓글 수: 2
Dija
Dija 2014년 11월 29일
it doesn't work :/
Dija
Dija 2014년 11월 29일
Thank you So much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by