MATLAB Answers

call vector in matrix with condition?

1 view (last 30 days)
ha ha
ha ha on 21 Mar 2018
Commented: ha ha on 21 Mar 2018
Let's say:
A=[1 2 3 10;4 5 6 15;7 8 9 20]
A=
1 2 3 10
4 5 6 15
7 8 9 20
B=[5 6 15;8 9 20]
B=
5 6 15
8 9 20
I want to call array C from A & B. How can?
C=[4;7]
  2 Comments
ha ha
ha ha on 21 Mar 2018
@Guillaume . I just want to call the value from first column in matrix A, If the matrix in column 2:4 in A is equal to matrix B, respectively

Sign in to comment.

Accepted Answer

ha ha
ha ha on 21 Mar 2018
A(ismember(A(:,2:4),B,'rows'),1);
  1 Comment
M
M on 21 Mar 2018
How does this correspond to A & B ?

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!