Delete rows with same elements
Mostrar comentarios más antiguos
a=[2 3 2;3 3 3;4 4 4;2 5 4; 3 5 5; 4 4 4; 7 3 4]
how do I delete only those rows where elemets repeat for entire row length. In this example matrix, the three rows with all 3s and all 4s where this happens.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 25 de Nov. de 2018
mask = all(diff(a, [], 2) == 0)
Now you can use mask as the row selector in deletion.
1 comentario
Walter Roberson
el 26 de Nov. de 2018
a(mask,:) = [];
Categorías
Más información sobre Correlation and Convolution en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!