MATLAB Answers

match row column of matrix

3 views (last 30 days)
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

  0 Comments

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 5 Feb 2020
Edited: Guillaume on 5 Feb 2020
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 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags