match row column of matrix

조회 수: 1 (최근 30일)
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya 2020년 2월 5일
편집: Guillaume 2020년 2월 5일
If I have one matrix
1 23
2 54
3 76
4 67
5 23
The other matrix
4
3
If there is way to get
If Iwant a matrix
4 67
3 76

채택된 답변

Guillaume
Guillaume 2020년 2월 5일
편집: Guillaume 2020년 2월 5일
A = [1 23
2 54
3 76
4 67
5 23];
B = [4;3];
result = A(ismember(A(:, 1), B), :) %keep the rows of A whose 1st column is a member of B

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by