delete rows which contain at least 1 zero
61 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mate 2u
el 7 de Jun. de 2012
Hi there I have a large matrix A. I want to delete every row which contains at least 1 zero in the row.
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 7 de Jun. de 2012
out = A(all(A,2),:);
or
out=A;
out(any(A==0,2),:) = [];
2 comentarios
Anthony Mukanya
el 17 de Ag. de 2015
Movida: Voss
el 24 de Mzo. de 2024
Thanks Andrei,
I tried what you suggested and it worked.
Now I would like to know what I should do keep the last row even if it contains a zero. The reason for this is because the entry on the nth row and jth must be zero.
Thanks
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!