call vector in matrix with condition?

1 visualización (últimos 30 días)
ha ha
ha ha el 21 de Mzo. de 2018
Comentada: ha ha el 21 de Mzo. de 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 comentarios
Guillaume
Guillaume el 21 de Mzo. de 2018
What does call array C from A & B actually mean?
You need to explain why C is 2x1 and not some other size, and where the 4 and 7 are derived from A and B.
ha ha
ha ha el 21 de Mzo. de 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

Iniciar sesión para comentar.

Respuesta aceptada

ha ha
ha ha el 21 de Mzo. de 2018
A(ismember(A(:,2:4),B,'rows'),1);
  1 comentario
M
M el 21 de Mzo. de 2018
How does this correspond to A & B ?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by