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 Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by