common part of two vectors

조회 수: 2 (최근 30일)
Darek Myszk
Darek Myszk 2018년 11월 7일
댓글: Star Strider 2018년 11월 7일
Hi. I Have a problem. I must to compare two vector: i.e A = [0 1 1 1 1] and B = [0 1 0 0 1]
to find two ones, in the same places in both vectors ->
I wrote something like this: [ii,jj]=find(A==B); but this also counts zero.
Thanks for help.

채택된 답변

Star Strider
Star Strider 2018년 11월 7일
Try this:
A = [0 1 1 1 1];
B = [0 1 0 0 1];
Result = A & B
Result =
1×5 logical array
0 1 0 0 1
  댓글 수: 2
Darek Myszk
Darek Myszk 2018년 11월 7일
Great :). My mistake, I tried to use "&&" and it didn't work. Habits from other codes. Thanks
Star Strider
Star Strider 2018년 11월 7일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by