How can i get a logical vector for all rows when compare each row of a column matrix with a another row column matrix

4 ビュー (過去 30 日間)
I have two matrix A and B, i want to compare these to matrix to get logical vector for each row.

採用された回答

Davide Masiello
Davide Masiello 2022 年 10 月 28 日
You can simply do
A = randi(10,5)
A = 5×5
4 9 8 1 1 3 9 9 2 3 10 10 10 3 1 6 3 6 4 6 1 5 9 5 4
B = randi(10,5)
B = 5×5
3 7 5 8 1 5 4 5 7 3 5 3 3 5 9 1 9 3 6 9 2 9 3 4 1
l = A == B
l = 5×5 logical array
0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  1 件のコメント
Chaudhary P Patel
Chaudhary P Patel 2022 年 10 月 29 日
Thank you so much sir.
Sir, what about if A, B and C three Column matrixes are there and i have to check
A<B<C

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by