how to select a whole row in a matrix

4 ビュー (過去 30 日間)
Luca Tognetti
Luca Tognetti 2022 年 12 月 6 日
コメント済み: Jan 2022 年 12 月 6 日
hi, I have two matrices with 20 rows and 4 columns and I want to compare them using ismember. my problem is that i want to consider every row as a single input as if my matrices are 20x1 vectors.
how can i do that?

採用された回答

Jan
Jan 2022 年 12 月 6 日
編集済み: Jan 2022 年 12 月 6 日
ismember(A, B, 'rows')
% Or maybe
ismember(A.', B.', 'rows')
  4 件のコメント
Luca Tognetti
Luca Tognetti 2022 年 12 月 6 日
i have the same problem with isequal... can you help me?
i want to evaluate if one row is equal to the following one, in case i would like an output (like 1 or 0)
Jan
Jan 2022 年 12 月 6 日
nextEq = ~any(diff(A, 1, 1), 2)
diff() subtracts elements of an array along the dimension specified as 3rd input argument. any(X, 2) checks if any element along the 2nd dimension differs from zero.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by