필터 지우기
필터 지우기

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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by