필터 지우기
필터 지우기

xor operation using loop

조회 수: 1 (최근 30일)
Urmila
Urmila 2014년 2월 24일
댓글: Urmila 2014년 2월 24일
i have 1 dimentional array say p=[1 0 1 0 1 1 1 0 0], now i want to xor its bits like
Q(l)= xor(p(i))...... where i=l,l+N,l+2n,l+3N...........upto i<10 And N=2 and 1<l<N
How to implement it in loop i dont understand..plz help me kindly
  댓글 수: 2
Mischa Kim
Mischa Kim 2014년 2월 24일
편집: Mischa Kim 2014년 2월 24일
Urmila, for logical operations you typically need two inputs, e.g., xor(1,0). In your example xor(p(i)) it looks like you only have one (at a time). Do you mean
Q(l) = xor(p(i),p(l))
Urmila
Urmila 2014년 2월 24일
my meaning of p(i) is p(1),p(3),p(5)...upto i<10 according to the equation. so how to take those particular bits for xoring..

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 24일
p=[1 0 1 0 1 1 1 0 0]
po=p(1:2:end)
out=po(1)
for k=2:numel(po)
out=xor(out,po(k))
end
  댓글 수: 1
Urmila
Urmila 2014년 2월 24일
Thank you sir..

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by