how to select a whole row in a matrix
조회 수: 4 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
Jan
2022년 12월 6일
편집: Jan
2022년 12월 6일
ismember(A, B, 'rows')
% Or maybe
ismember(A.', B.', 'rows')
댓글 수: 4
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 Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!