I have two logical vectors:
A = [0 1 1 1 1 0 0] B = [0 0 0 0 0 0 0]
C = A & B % C = [0 0 0 0 0 0 0]
Can someone explain to me why C = [0 0 0 0 0 0 0].

 채택된 답변

John D'Errico
John D'Errico 2018년 3월 11일

0 개 추천

The & operator works on the elements of the two variables element-wise.
Since All elements of B are 0 (false) and it is true that if you and anything with false, then the result is uniformly false.
What else would you have expected?

댓글 수: 1

Mark Tenorio
Mark Tenorio 2018년 3월 11일
I don't know. That's why I hit the Ask button. But thank you for answering my question :)

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

추가 답변 (0개)

카테고리

질문:

2018년 3월 11일

댓글:

2018년 3월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by