how to select a whole row in a matrix

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?

 Respuesta aceptada

Jan
Jan el 6 de Dic. de 2022
Editada: Jan el 6 de Dic. de 2022
ismember(A, B, 'rows')
% Or maybe
ismember(A.', B.', 'rows')

4 comentarios

Luca Tognetti
Luca Tognetti el 6 de Dic. de 2022
thanks, i'm new in matlab
You are welcome.
Matlab's documentation is very good. Questions concerning a command can be clarified by the help sections usually:
help ismember
doc ismember
Luca Tognetti
Luca Tognetti el 6 de Dic. de 2022
i have the same problem with isequal... can you help me?
i want to evaluate if one row is equal to the following one, in case i would like an output (like 1 or 0)
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2021b

Etiquetas

Preguntada:

el 6 de Dic. de 2022

Comentada:

Jan
el 6 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by